Terry J. Reedy added the comment:

To me, there are two independent improvements: using i and hence msg to 
identify the erroneous dup, and using .subTest to test all dups. I would 
combine ideas from both the first two patches to do both.

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

2. within both loops, add msg to all asserts as in the first patch. If there is 
a failure, one would want to know both the source of the dup (indicated by i) 
and the content, and how it differed from the model.

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

Test the revised tests by temporarily adding both the original (failing the 
'is' test) and a partial and therefore faulty copy of the original to both list 
of dups. Verify that both errors are reported for each and that the message 
formatting looks ok.

----------
nosy: +terry.reedy

_______________________________________
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