Terry J. Reedy added the comment: > becouse we have no a string which determine a test.
The original loop could be have been written as (or be changed to) for label, dup in [ ('odcopy', od.copy()), ('copycopy', copy.copy(words)), <and so on> ] and the label used to identify the test, whether passed to assertX or subTest. The test author (Raymond H.) thought the sequence number enough in the off chance there ever were a failure. >When the test fails, dup is not expected value and printing it can raise an >exception and prevent formatting useful error message. I do not understand this, unittest assumes that tested objects are printable. Indeed, assertEqual(dup, words/od) will do that (making the message redundant for this particular test. So I think the best fix would be to redo the loop header as above, pass label to subTest so it appears for any failure (which intertwines subTest with this issue), and only pass a message to assert where actually needed (like the len test). ---------- _______________________________________ 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