From: Sergey Matveev Date: Sat, 30 Nov 2024 19:02:51 +0000 (+0300) Subject: Missing non-minimal TAI64 testing X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3b17bc0e979729fb374a86ca2997fd79b273cea2478c7213183972e44a50b8cb;p=keks.git Missing non-minimal TAI64 testing --- diff --git a/pyac/tests/test_tai.py b/pyac/tests/test_tai.py index d286607..5105726 100644 --- a/pyac/tests/test_tai.py +++ b/pyac/tests/test_tai.py @@ -129,6 +129,30 @@ class TestTAI64(TestCase): ) self.assertEqual(str(err.exception), "too many attoseconds") + def test_zero_nanoseconds(self) -> None: + with self.assertRaises(DecodeError) as err: + loads( + b"\x19\x40\x00\x00\x00\x00\x00\x00\x00" + + b"\x00\x00\x00\x00" + ) + self.assertEqual(str(err.exception), "non-minimal TAI64N") + + def test_zero_attoseconds(self) -> None: + with self.assertRaises(DecodeError) as err: + loads( + b"\x1a\x40\x00\x00\x00\x00\x00\x00\x00" + + b"\x00\x00\x00\x00" + + b"\x00\x00\x00\x00" + ) + self.assertEqual(str(err.exception), "non-minimal TAI64NA") + + def test_zero_nanoseconds_ok_for_tai64na(self) -> None: + loads( + b"\x1a\x40\x00\x00\x00\x00\x00\x00\x00" + + b"\x00\x00\x00\x00" + + b"\x00\x00\x00\x01" + ) + class TestLeapsecs(TestCase): def test_match_DJB(self) -> None: