MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_timestamp_aware

Method test_timestamp_aware

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

Source from the content-addressed store, hash-verified

2667 self.assertEqual(self.theclass.fromtimestamp(s), t)
2668
2669 def test_timestamp_aware(self):
2670 t = self.theclass(1970, 1, 1, tzinfo=timezone.utc)
2671 self.assertEqual(t.timestamp(), 0.0)
2672 t = self.theclass(1970, 1, 1, 1, 2, 3, 4, tzinfo=timezone.utc)
2673 self.assertEqual(t.timestamp(),
2674 3600 + 2*60 + 3 + 4*1e-6)
2675 t = self.theclass(1970, 1, 1, 1, 2, 3, 4,
2676 tzinfo=timezone(timedelta(hours=-5), 'EST'))
2677 self.assertEqual(t.timestamp(),
2678 18000 + 3600 + 2*60 + 3 + 4*1e-6)
2679
2680 @support.run_with_tz('MSK-03') # Something east of Greenwich
2681 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