diff --git a/pa1010d/__init__.py b/pa1010d/__init__.py index 2a5ac81..98b014e 100644 --- a/pa1010d/__init__.py +++ b/pa1010d/__init__.py @@ -79,7 +79,7 @@ def send_command(self, command, add_checksum=True): If add_checksum is True (the default) a NMEA checksum will automatically be computed and added. """ - if isinstance(command, bytes): + if not isinstance(command, bytes): command = command.encode("ascii") # TODO replace with pynmea2 functionality diff --git a/tests/conftest.py b/tests/conftest.py index 3881efb..0ab7518 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -26,6 +26,6 @@ def write_byte(self, address, data): def smbus(): smbus = mock.MagicMock() smbus.SMBus = SMBus - sys.modules["smbus"] = smbus + sys.modules["smbus2"] = smbus yield smbus - del sys.modules["smbus"] + del sys.modules["smbus2"]