summaryrefslogtreecommitdiffstats
path: root/test/test_otultra2.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_otultra2.py')
-rw-r--r--test/test_otultra2.py63
1 files changed, 31 insertions, 32 deletions
diff --git a/test/test_otultra2.py b/test/test_otultra2.py
index 5474c1f..5007ca7 100644
--- a/test/test_otultra2.py
+++ b/test/test_otultra2.py
@@ -14,58 +14,57 @@ import mock
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from glucometerutils import common
from glucometerutils.drivers import lifescan_common
from glucometerutils.drivers import otultra2
from glucometerutils import exceptions
class TestOTUltra2(unittest.TestCase):
- def setUp(self):
- self.addCleanup(mock.patch.stopall)
+ def setUp(self):
+ self.addCleanup(mock.patch.stopall)
- mock_serial = mock.patch('serial.Serial').start()
- self.mock_readline = mock_serial.return_value.readline
+ mock_serial = mock.patch('serial.Serial').start()
+ self.mock_readline = mock_serial.return_value.readline
- self.device = otultra2.Device('mockdevice')
+ self.device = otultra2.Device('mockdevice')
- def _set_return_string(self, string):
- self.mock_readline.return_value = bytes(string, 'ascii')
+ def _set_return_string(self, string):
+ self.mock_readline.return_value = bytes(string, 'ascii')
- def testMissingChecksum(self):
- self._set_return_string('INVALID')
+ def test_missing_checksum(self):
+ self._set_return_string('INVALID')
- self.assertRaises(lifescan_common.MissingChecksum,
- self.device.get_serial_number)
+ self.assertRaises(lifescan_common.MissingChecksum,
+ self.device.get_serial_number)
- def testShortResponse(self):
- self._set_return_string('.\r')
+ def test_short_response(self):
+ self._set_return_string('.\r')
- self.assertRaises(exceptions.InvalidResponse,
- self.device.get_serial_number)
+ self.assertRaises(exceptions.InvalidResponse,
+ self.device.get_serial_number)
- def testInvalidResponse(self):
- self._set_return_string('% 2500\r')
+ def test_invalid_response(self):
+ self._set_return_string('% 2500\r')
- self.assertRaises(exceptions.InvalidResponse,
- self.device.get_serial_number)
+ self.assertRaises(exceptions.InvalidResponse,
+ self.device.get_serial_number)
- def testInvalidSerialNumber(self):
- self._set_return_string('@ "12345678O" 0297\r')
+ def test_invalid_serial_number(self):
+ self._set_return_string('@ "12345678O" 0297\r')
- self.assertRaises(lifescan_common.InvalidSerialNumber,
- self.device.get_serial_number)
+ self.assertRaises(lifescan_common.InvalidSerialNumber,
+ self.device.get_serial_number)
- def testInvalidChecksum(self):
- self._set_return_string('% 1337\r')
+ def test_invalid_checksum(self):
+ self._set_return_string('% 1337\r')
- self.assertRaises(lifescan_common.InvalidChecksum,
- self.device.get_serial_number)
+ self.assertRaises(lifescan_common.InvalidChecksum,
+ self.device.get_serial_number)
- def testBrokenChecksum(self):
- self._set_return_string('% 13AZ\r')
+ def test_broken_checksum(self):
+ self._set_return_string('% 13AZ\r')
- self.assertRaises(lifescan_common.MissingChecksum,
- self.device.get_serial_number)
+ self.assertRaises(lifescan_common.MissingChecksum,
+ self.device.get_serial_number)
if __name__ == '__main__':
unittest.main()