summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.com>2021-03-01 21:48:18 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-03-01 21:51:14 +0100
commit79cf39ef17f50e2bcfb2729ecef9c2dbbe827afb (patch)
treeee10059b2776c104de5b79fffc336c01738c7e6b
parenttd42xx: updat eextra definition in setup.py. (diff)
downloadglucometerutils-79cf39ef17f50e2bcfb2729ecef9c2dbbe827afb.tar
glucometerutils-79cf39ef17f50e2bcfb2729ecef9c2dbbe827afb.tar.gz
glucometerutils-79cf39ef17f50e2bcfb2729ecef9c2dbbe827afb.tar.bz2
glucometerutils-79cf39ef17f50e2bcfb2729ecef9c2dbbe827afb.tar.lz
glucometerutils-79cf39ef17f50e2bcfb2729ecef9c2dbbe827afb.tar.xz
glucometerutils-79cf39ef17f50e2bcfb2729ecef9c2dbbe827afb.tar.zst
glucometerutils-79cf39ef17f50e2bcfb2729ecef9c2dbbe827afb.zip
Diffstat (limited to '')
-rw-r--r--glucometerutils/drivers/tests/test_td42xx.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/glucometerutils/drivers/tests/test_td42xx.py b/glucometerutils/drivers/tests/test_td42xx.py
new file mode 100644
index 0000000..556d296
--- /dev/null
+++ b/glucometerutils/drivers/tests/test_td42xx.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+#
+# SPDX-FileCopyrightText: © 2019 The glucometerutils Authors
+# SPDX-License-Identifier: MIT
+"""Tests for the TD-42xx driver."""
+
+# pylint: disable=protected-access,missing-docstring
+
+import datetime
+
+from absl.testing import parameterized
+
+from glucometerutils.drivers import td42xx
+
+
+class TestTD4277Nexus(parameterized.TestCase):
+ @parameterized.parameters(
+ (b"\x21\x24\x0e\x15", datetime.datetime(2018, 1, 1, 21, 14)),
+ (b"\x21\x26\x0e\x15", datetime.datetime(2019, 1, 1, 21, 14)),
+ (b"\x04\x27\x25\x0d", datetime.datetime(2019, 8, 4, 13, 37)),
+ )
+ def test_parse_datetime(self, message, date):
+ self.assertEqual(td42xx._parse_datetime(message), date)
+
+ def test_making_message(self):
+ self.assertEqual(
+ td42xx._make_packet(0x22, 0), b"\x51\x22\x00\x00\x00\x00\xa3\x16"
+ )