Message297029
| Author |
musically_ut |
| Recipients |
belopolsky, martin.panter, musically_ut, serhiy.storchaka |
| Date |
2017年06月27日.12:32:21 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1498566742.09.0.366591585896.issue30302@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|