Message256574
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 '[[]]'. |
|
Date |
User |
Action |
Args |
2015-12-17 04:37:02 | zach.ware | set | recipients:
+ zach.ware, pitrou, rbcollins, ezio.melotti, michael.foord, Nan Wu |
2015-12-17 04:37:01 | zach.ware | set | messageid: <1450327021.96.0.562008085976.issue25651@psf.upfronthosting.co.za> |
2015-12-17 04:37:01 | zach.ware | link | issue25651 messages |
2015-12-17 04:37:01 | zach.ware | create | |
|