Utkarsh Upadhyay added the comment: I've added the following tests to remove the 0 attributes from the repr:
self.assertEqual(repr(self.theclass(days=1, seconds=0)), "%s(days=1)" % name) self.assertEqual(repr(self.theclass(seconds=60)), "%s(seconds=60)" % name) self.assertEqual(repr(self.theclass()), "%s(seconds=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) I am still ambivalent about factoring the minus sign outside, though. I've also fixed a bug in test_datetime.py which prevented execution of the Python implementation in Lib/datetime.py. TODO: - Decide about factoring the minus sign. - Drop description of timedelta.__repr__ from the documentation. ~ ut ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30302> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com