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

Method test_total_seconds

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

Source from the content-addressed store, hash-verified

668 self.assertEqual(td.microseconds, us)
669
670 def test_total_seconds(self):
671 td = timedelta(days=365)
672 self.assertEqual(td.total_seconds(), 31536000.0)
673 for total_seconds in [123456.789012, -123456.789012, 0.123456, 0, 1e6]:
674 td = timedelta(seconds=total_seconds)
675 self.assertEqual(td.total_seconds(), total_seconds)
676 # Issue8644: Test that td.total_seconds() has the same
677 # accuracy as td / timedelta(seconds=1).
678 for ms in [-1, -2, -123]:
679 td = timedelta(microseconds=ms)
680 self.assertEqual(td.total_seconds(), td / timedelta(seconds=1))
681
682 def test_carries(self):
683 t1 = timedelta(days=100,

Callers

nothing calls this directly

Calls 3

timedeltaClass · 0.90
total_secondsMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected