def test_to_native(self): t = Time(12, 34, 56.789123456) native = t.to_native() self.assertEqual(t.hour, native.hour) self.assertEqual(t.minute, native.minute) self.assertEqual( 56.789123, nano_add(native.second, nano_div(native.microsecond, 1000000)))
def test_to_native_case_2(): # python -m pytest tests/unit/time/test_time.py -s -v -k test_to_native_case_2 t = Time(12, 34, 56.789123456, tzinfo=timezone_utc) native = t.to_native() assert native.hour == t.hour assert native.minute == t.minute assert nano_add(native.second, nano_div(native.microsecond, 1000000)) == 56.789123 assert native.tzinfo == FixedOffset(0) assert native.isoformat() == "12:34:56.789123+00:00"
def test_to_native_case_1(): # python -m pytest tests/unit/time/test_time.py -s -v -k test_to_native_case_1 t = Time(12, 34, 56.789123456) native = t.to_native() assert native.hour == t.hour assert native.minute == t.minute assert nano_add(native.second, nano_div(native.microsecond, 1000000)) == 56.789123 assert native.tzinfo is None assert native.isoformat() == "12:34:56.789123"