MCPcopy Index your code
hub / github.com/python/cpython / test_timestamp_aware

Method test_timestamp_aware

Lib/test/datetimetester.py:2718–2727  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2716 self.assertEqual(self.theclass.fromtimestamp(s), t)
2717
2718 def test_timestamp_aware(self):
2719 t = self.theclass(1970, 1, 1, tzinfo=timezone.utc)
2720 self.assertEqual(t.timestamp(), 0.0)
2721 t = self.theclass(1970, 1, 1, 1, 2, 3, 4, tzinfo=timezone.utc)
2722 self.assertEqual(t.timestamp(),
2723 3600 + 2*60 + 3 + 4*1e-6)
2724 t = self.theclass(1970, 1, 1, 1, 2, 3, 4,
2725 tzinfo=timezone(timedelta(hours=-5), 'EST'))
2726 self.assertEqual(t.timestamp(),
2727 18000 + 3600 + 2*60 + 3 + 4*1e-6)
2728
2729 @support.run_with_tz('MSK-03') # Something east of Greenwich
2730 def test_microsecond_rounding(self):

Callers

nothing calls this directly

Calls 4

timezoneClass · 0.90
timedeltaClass · 0.90
timestampMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected