TagTAI64N = 0x19
TagTAI64NA = 0x1A
+# This is output of: curl http://cr.yp.to/libtai/leapsecs.dat | xxd -c 8 -p
DJB_Leapsecs = (
"4000000004b2580a",
"4000000005a4ec0b",
)
self.assertEqual(str(err.exception), "too many attoseconds")
- def test_leapseconds_match_DJB(self) -> None:
- """Check that our pyac.Leapsecs is equally calculated to DJB's
- ``curl http://cr.yp.to/libtai/leapsecs.dat | xxd -c 8 -p``
+
+class TestLeapsecs(TestCase):
+ def test_match_DJB(self) -> None:
+ """Check that our pyac.Leapsecs is equally calculated to DJB's one
"""
- for our, their in zip(
- Leapsecs,
- DJB_Leapsecs
- ):
+ for our, their in zip(Leapsecs, DJB_Leapsecs):
self.assertEqual(
our,
int.from_bytes(bytes.fromhex(their), "big") - TAI64Base,
)
- def test_decode_leapsecond(self) -> None:
+ def test_decode(self) -> None:
for leapsec in DJB_Leapsecs:
- decoded, tail = loads(v=b"\x18" + bytes.fromhex(leapsec), leapsecUTCAllow=True)
+ decoded, tail = loads(
+ v=b"\x18" + bytes.fromhex(leapsec),
+ leapsecUTCAllow=True,
+ )
self.assertIsInstance(decoded, datetime)
- decoded, tail = loads(v=b"\x18" + bytes.fromhex(leapsec), leapsecUTCAllow=False)
+ decoded, tail = loads(
+ v=b"\x18" + bytes.fromhex(leapsec),
+ leapsecUTCAllow=False,
+ )
self.assertIsInstance(decoded, Raw)