From 0af0315dba3590ff5a975783cf8f7bc13460a5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 1 Jan 2018 01:16:29 +0000 Subject: otultraeasy: rewrite using construct for parsing. This removes the wholly complicated _Packet() object and replace it with more readable construct. Unfortunately this appears to reduce performance because of the serial stream buffering, needed to calculate the checksum. It's unfortunate, but it at least avoids a significant amount of custom code. --- test/test_otultraeasy.py | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'test/test_otultraeasy.py') diff --git a/test/test_otultraeasy.py b/test/test_otultraeasy.py index a1d4c02..52a98f1 100644 --- a/test/test_otultraeasy.py +++ b/test/test_otultraeasy.py @@ -38,23 +38,6 @@ class TestOTUltraMini(unittest.TestCase): 0x62C2, lifescan.crc_ccitt(cmd_array)) - def test_packet_update_checksum(self): - packet = otultraeasy._Packet() - - packet.build_command('') - packet.disconnect = True - - packet.update_checksum() - self.assertEqual( - b'\x02\x06\x08\x03\xC2\x62', - packet.tobytes()) - - packet.validate_checksum() - packet.disconnect = False - - with self.assertRaises(exceptions.InvalidChecksum): - packet.validate_checksum() - if __name__ == '__main__': unittest.main() -- cgit v1.2.3