Vajrasky Kok added the comment: I redo the test as Terry J. Reedy suggested. I use label in loop, utilize subTest receiving label parameter, and pass messages to only necessary asserts.
So roughly if the test fails, we would get something like this: ====================================================================== FAIL: test_copying (__main__.TestOrderedDict) (label='OrderedDict(od)') ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_collections.py", line 1237, in test_copying self.assertTrue(dup is not dup, msg) AssertionError: False is not true : copy: OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]) od: OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]) ====================================================================== FAIL: test_copying (__main__.TestCounter) (label='Counter(words)') ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_collections.py", line 942, in test_copying self.assertEqual(type(dup), type(''), msg) AssertionError: <class 'collections.Counter'> != <class 'str'> : copy: Counter({'which': 2, 'witches': 1, 'witch': 1, 'watch': 1, 'wrist': 1, 'had': 1}) words: Counter({'which': 2, 'witches': 1, 'had': 1, 'watch': 1, 'witch': 1, 'wrist': 1}) ---------- Added file: http://bugs.python.org/file30443/test_with_label_and_subTest.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18106> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com