fuzzyman at voidspace.org.uk
Mon Sep 27 14:46:19 PDT 2010
On 27/09/2010 22:41, Matthew Woodcraft wrote:
> Michael Foord<fuzzyman at voidspace.org.uk> wrote:
>> Matthew Woodcraft wrote:
>>> But I think what I'd really like here is
>>> for something like TestCase._formatMessage to be public: it seems to me
>>> that pretty much anyone writing a custom TypeEqualityFunc is going to
>>> want this facility, and it's bit of a shame to have to reimplement it.
>> Ok - that's a reasonable request. Can you raise an issue for it?
> I tried, but it won't let me without a 'Google account' :-(. Would it be
> helpful if I put it in as a wishlist request on the Python tracker?
>>> The other is unorderable_list_difference.
>> That's in unittest in Python 2.7 - so I doubt it will be removed /
>> moved. :-)
> Excellent. Thank you for your quick response.
>>> In this case, I think what I'd really like is a (variant of)
>>> assertItemsEqual which always uses the form of output it chooses for
>>> 'unsortable' items, as I find it's usually easier for me to read.
>> I don't understand what you mean by this. What are you trying to compare
>> and why is the output not good enough?
> Here's an example:
> a = [('b', (2, 3)), ('w', (3, 4))]
> b = [('x', (2, 3)), ('w', (3, 4))]
> case.assertItemsEqual(a, b)
> unorderable_list_difference gives
> Expected, but missing:
> [('b', (2, 3))]
> Unexpected, but present:
> [('x', (2, 3))]
> while the current assertItemsEqual gives
> Sequences differ: [('b', (2, 3)), ('w', (3, 4))] != [('w', (3, 4)), ('x', (2, 3))]
> First differing element 0:
> ('b', (2, 3))
> ('w', (3, 4))
> - [('b', (2, 3)), ('w', (3, 4))]
> + [('w', (3, 4)), ('x', (2, 3))]
> I find the first more convenient.
> In general, I think that in assertItemsEqual, the 'first differing
> element' bit (that has come from assertSequenceEqual) is as likely to be
> misleading as it is to be helpful.
Can you report this too (just copy it into the tracker) and I'll look at it.
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
More information about the testing-in-python