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 terry.reedy
Recipients ezio.melotti, michael.foord, pitrou, serhiy.storchaka, terry.reedy, vajrasky
Date 2013-06-01.19:35:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1370115340.27.0.231833871957.issue18106@psf.upfronthosting.co.za>
In-reply-to
Content
> 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).
History
Date User Action Args
2013-06-01 19:35:40terry.reedysetrecipients: + terry.reedy, pitrou, ezio.melotti, michael.foord, serhiy.storchaka, vajrasky
2013-06-01 19:35:40terry.reedysetmessageid: <1370115340.27.0.231833871957.issue18106@psf.upfronthosting.co.za>
2013-06-01 19:35:40terry.reedylinkissue18106 messages
2013-06-01 19:35:37terry.reedycreate