Zachary Ware added the comment:

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 '[[]]'.

----------
nosy: +zach.ware

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25651>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to