From 6bfc12f901e938f95ea64bd0a80090333769e234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Wed, 29 Jan 2014 22:45:05 +0000 Subject: otultra2: move checksum function within otultra2 driver. The function is not shared with the Ultra Easy and likely not with other devices either. --- test/test_lifescan.py | 28 ---------------------------- test/test_otultra2.py | 8 ++++++++ 2 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 test/test_lifescan.py (limited to 'test') diff --git a/test/test_lifescan.py b/test/test_lifescan.py deleted file mode 100644 index 7252bec..0000000 --- a/test/test_lifescan.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -"""Tests for the LifeScan Common functions.""" - -__author__ = 'Diego Elio Pettenò' -__email__ = 'flameeyes@flameeyes.eu' -__copyright__ = 'Copyright © 2013, Diego Elio Pettenò' -__license__ = 'MIT' - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - -from glucometerutils.drivers import lifescan_common - - -class TestOTUltra2(unittest.TestCase): - def test_checksum(self): - checksum = lifescan_common.calculate_checksum(bytes('T', 'ascii')) - self.assertEqual(0x0054, checksum) - - checksum = lifescan_common.calculate_checksum( - bytes('T "SAT","08/03/13","22:12:00 "', 'ascii')) - self.assertEqual(0x0608, checksum) - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_otultra2.py b/test/test_otultra2.py index 5007ca7..4d59f6a 100644 --- a/test/test_otultra2.py +++ b/test/test_otultra2.py @@ -30,6 +30,14 @@ class TestOTUltra2(unittest.TestCase): def _set_return_string(self, string): self.mock_readline.return_value = bytes(string, 'ascii') + def test_checksum(self): + checksum = otultra2._calculate_checksum(bytes('T', 'ascii')) + self.assertEqual(0x0054, checksum) + + checksum = otultra2._calculate_checksum( + bytes('T "SAT","08/03/13","22:12:00 "', 'ascii')) + self.assertEqual(0x0608, checksum) + def test_missing_checksum(self): self._set_return_string('INVALID') -- cgit v1.2.3