Serhiy Storchaka added the comment:

subTest() serves two purposes: identify the test case and continue testing
oother test cases after a fail. For first purpose subTest() is not well
suitable in these tests, becouse we have no a string which determine a
test. Second purpose is not relevant to original issue.

1. a fancy formatted message would be more useful with less fluff and the
> two displays each on their own line.
>
> msg = "iteration %s\ncopy: %s\norig: %s" % (i, dup, words)
> # or od for OrderedDict test
>

When the test fails, dup is not expected value and printing it can raise an
exception and prevent formatting useful error message. Failure report
should be succesful in any case.

3. wrap the bodies of both loops with 'with self.subTest():' to always test
> all dups. Unrolling the loops prevents doing this.
>

Of course you can wrap a body of the check() function.

----------

_______________________________________
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

Reply via email to