This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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
History
Date User Action Args
2017-06-27 12:32:22musically_utsetrecipients: + musically_ut, belopolsky, martin.panter, serhiy.storchaka
2017-06-27 12:32:22musically_utsetmessageid: <1498566742.09.0.366591585896.issue30302@psf.upfronthosting.co.za>
2017-06-27 12:32:22musically_utlinkissue30302 messages
2017-06-27 12:32:21musically_utcreate