diff options
author | Utkarsh Upadhyay <mail@musicallyut.in> | 2017-07-25 21:51:33 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2017-07-25 21:51:33 (GMT) |
commit | cc5a65cd9025280ea67ef4bbc2a8bfe31ced6c30 (patch) | |
tree | 4565cd48860cd2c8581225565509ea327293b7f9 /Lib/test/datetimetester.py | |
parent | 830080913c22a9834d310294b9f7653234dc6a59 (diff) | |
download | cpython-cc5a65cd9025280ea67ef4bbc2a8bfe31ced6c30.zip cpython-cc5a65cd9025280ea67ef4bbc2a8bfe31ced6c30.tar.gz cpython-cc5a65cd9025280ea67ef4bbc2a8bfe31ced6c30.tar.bz2 |
bpo-30302 Make timedelta.__repr__ more informative. (#1493)
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r-- | Lib/test/datetimetester.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index b25e6c1..2200888 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -658,11 +658,21 @@ class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase): def test_repr(self): name = 'datetime.' + self.theclass.__name__ self.assertEqual(repr(self.theclass(1)), - "%s(1)" % name) + "%s(days=1)" % name) self.assertEqual(repr(self.theclass(10, 2)), - "%s(10, 2)" % name) + "%s(days=10, seconds=2)" % name) self.assertEqual(repr(self.theclass(-10, 2, 400000)), - "%s(-10, 2, 400000)" % name) + "%s(days=-10, seconds=2, microseconds=400000)" % name) + self.assertEqual(repr(self.theclass(seconds=60)), + "%s(seconds=60)" % name) + self.assertEqual(repr(self.theclass()), + "%s(0)" % name) + self.assertEqual(repr(self.theclass(microseconds=100)), + "%s(microseconds=100)" % name) + self.assertEqual(repr(self.theclass(days=1, microseconds=100)), + "%s(days=1, microseconds=100)" % name) + self.assertEqual(repr(self.theclass(seconds=1, microseconds=100)), + "%s(seconds=1, microseconds=100)" % name) def test_roundtrip(self): for td in (timedelta(days=999999999, hours=23, minutes=59, |