diff options
Diffstat (limited to 'Lib/test/test_datetime.py')
-rw-r--r-- | Lib/test/test_datetime.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py index 8bf8420..d85217d 100644 --- a/Lib/test/test_datetime.py +++ b/Lib/test/test_datetime.py @@ -261,6 +261,13 @@ class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase): self.assertEqual(td.seconds, seconds) self.assertEqual(td.microseconds, us) + def test_total_seconds(self): + td = timedelta(days=365) + self.assertEqual(td.total_seconds(), 31536000.0) + for total_seconds in [123456.789012, -123456.789012, 0.123456, 0, 1e6]: + td = timedelta(seconds=total_seconds) + self.assertEqual(td.total_seconds(), total_seconds) + def test_carries(self): t1 = timedelta(days=100, weeks=-7, |