summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.com>2019-09-02 23:53:48 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.com>2019-09-02 23:53:48 +0200
commit396af3447792307c2768b770dc1a79fa55cdd7db (patch)
treeebeb8b556528fc088c0464f6f448cc2075dd80bd
parentfsoptium: fix error in date stirng parsing. (diff)
downloadglucometerutils-396af3447792307c2768b770dc1a79fa55cdd7db.tar
glucometerutils-396af3447792307c2768b770dc1a79fa55cdd7db.tar.gz
glucometerutils-396af3447792307c2768b770dc1a79fa55cdd7db.tar.bz2
glucometerutils-396af3447792307c2768b770dc1a79fa55cdd7db.tar.lz
glucometerutils-396af3447792307c2768b770dc1a79fa55cdd7db.tar.xz
glucometerutils-396af3447792307c2768b770dc1a79fa55cdd7db.tar.zst
glucometerutils-396af3447792307c2768b770dc1a79fa55cdd7db.zip
Diffstat (limited to '')
-rw-r--r--test/test_fsoptium.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/test_fsoptium.py b/test/test_fsoptium.py
new file mode 100644
index 0000000..d9a1ccb
--- /dev/null
+++ b/test/test_fsoptium.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+#
+# SPDX-License-Identifier: MIT
+"""Tests for the FreeStyle Optium driver."""
+
+# pylint: disable=protected-access,missing-docstring
+
+import datetime
+
+from absl.testing import parameterized
+
+from glucometerutils.drivers import fsoptium
+from glucometerutils import exceptions
+
+
+class TestFreeStyleOptium(parameterized.TestCase):
+
+ @parameterized.parameters(
+ ('Clock:\tApr 22 2014\t02:14:37',
+ datetime.datetime(2014, 4, 22, 2, 14, 37)),
+ ('Clock:\tJul 10 2013\t14:26:44',
+ datetime.datetime(2013, 7, 10, 14, 26, 44)),
+ ('Clock:\tSep 29 2013\t17:35:34',
+ datetime.datetime(2013, 9, 29, 17, 35, 34)),
+ )
+ def test_parse_clock(self, datestr, datevalue):
+ self.assertEqual(
+ fsoptium._parse_clock(datestr),
+ datevalue)
+
+ @parameterized.parameters(
+ ('Apr 22 2014 02:14:37',),
+ ('Clock:\tXxx 10 2013\t14:26',),
+ ('Clock:\tSep 29 2013\t17:35:22.34',),
+ ('Foo',)
+ )
+ def test_parse_clock_invalid(self, datestr):
+ with self.assertRaises(exceptions.InvalidResponse):
+ fsoptium._parse_clock(datestr)