diff options
author | Diego Elio Pettenò <flameeyes@flameeyes.com> | 2019-08-03 15:29:14 +0200 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@flameeyes.com> | 2019-08-03 15:56:44 +0200 |
commit | d7ab5281015dbfe5c92d471894e6f63d693bad6f (patch) | |
tree | 644421ff70e9ba8119835a5865ae8e4f8ae1e6fa /test | |
parent | Fix invalid attribute in setup() method. (diff) | |
download | glucometerutils-d7ab5281015dbfe5c92d471894e6f63d693bad6f.tar glucometerutils-d7ab5281015dbfe5c92d471894e6f63d693bad6f.tar.gz glucometerutils-d7ab5281015dbfe5c92d471894e6f63d693bad6f.tar.bz2 glucometerutils-d7ab5281015dbfe5c92d471894e6f63d693bad6f.tar.lz glucometerutils-d7ab5281015dbfe5c92d471894e6f63d693bad6f.tar.xz glucometerutils-d7ab5281015dbfe5c92d471894e6f63d693bad6f.tar.zst glucometerutils-d7ab5281015dbfe5c92d471894e6f63d693bad6f.zip |
Diffstat (limited to 'test')
-rw-r--r-- | test/test_td4277.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test_td4277.py b/test/test_td4277.py new file mode 100644 index 0000000..6f4ff9a --- /dev/null +++ b/test/test_td4277.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# +# SPDX-License-Identifier: MIT +"""Tests for the TD-4277 driver.""" + +# pylint: disable=protected-access,missing-docstring + +import datetime + +from absl.testing import parameterized + +from glucometerutils.drivers import td4277 +from glucometerutils.support import lifescan +from glucometerutils import exceptions + + +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(td4277._parse_datetime(message), + date) + + def test_making_message(self): + self.assertEqual( + td4277._make_packet(0x22, 0), + b'\x51\x22\x00\x00\x00\x00\xa3\x16') |