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 zach.ware
Recipients Nan Wu, ezio.melotti, michael.foord, pitrou, rbcollins, zach.ware
Date 2015-12-17.04:37:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450327021.96.0.562008085976.issue25651@psf.upfronthosting.co.za>
In-reply-to
Content
I think Ezio's suggestion of a sentinel value would be better, allowing None to be using as a legitimate 'message' [1].  That is, somewhere at global scope, define '_subtest_msg_sentinel = object()', change the msg default at Lib/unittest/case.py:500 to be 'msg=_subtest_msg_sentinel', and change the check at Lib/unittest/case.py:1400 to check 'if message is not _subtest_msg_sentinel'.


[1] For example:

   class TruthTest(unittest.TestCase):
       def test_truth(self):
           for o in None, 1, 0, [], (4,):
               with self.subTest(o):
                   self.assertTrue(o)

Should print failure results including '[None]', '[0]', and '[[]]'.
History
Date User Action Args
2015-12-17 04:37:02zach.waresetrecipients: + zach.ware, pitrou, rbcollins, ezio.melotti, michael.foord, Nan Wu
2015-12-17 04:37:01zach.waresetmessageid: <1450327021.96.0.562008085976.issue25651@psf.upfronthosting.co.za>
2015-12-17 04:37:01zach.warelinkissue25651 messages
2015-12-17 04:37:01zach.warecreate