[issue9977] TestCase.assertItemsEqual's description of differences

2011-01-03 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

In Python 3.2 assertItemsEqual has been replaced with assertCountEqual that has 
a completely different implementation and error format. The implementation and 
error output will be backported to the assertItemsEqual method of 2.7 (and to 
unittest2).

Error output:

AssertionError: Element counts were not equal:
First has 1, Second has 0:  ('b', (2, 3))
First has 0, Second has 1:  ('x', (2, 3))

--
resolution:  - invalid
stage: unit test needed - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9977] TestCase.assertItemsEqual's description of differences

2010-10-31 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9977] TestCase.assertItemsEqual's description of differences

2010-10-01 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

If I understand correctly, you are requesting that .assertItemsEqual only use 
the 2nd (multiset comparison) method, so that if one want the first method, one 
should directly call .assertSequenceEqual(sorted(a), sorted(b)).

This seems reasonable to me, but I do not use the unittest module, and I 
suspect others want the implicit call.

--
nosy: +terry.reedy
stage:  - unit test needed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9977] TestCase.assertItemsEqual's description of differences

2010-10-01 Thread Matthew Woodcraft

Matthew Woodcraft matt...@woodcraft.me.uk added the comment:

Terry J. Reedy wrote:
 If I understand correctly, you are requesting that .assertItemsEqual
 only use the 2nd (multiset comparison) method, so that if one want the
 first method, one should directly call .assertSequenceEqual(sorted(a),
 sorted(b)).

Yes, that would make me happy. So would a new assertXXXEqual method that
always did the multiset comparison.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9977] TestCase.assertItemsEqual's description of differences

2010-09-30 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9977] TestCase.assertItemsEqual's description of differences

2010-09-28 Thread Matthew Woodcraft

New submission from Matthew Woodcraft matt...@woodcraft.me.uk:

TestCase.assertItemsEqual uses two different techniques to describe the
differences in the inputs that it compares.

If the inputs are sortable, it sorts them and then uses
assertSequenceEqual to describe the difference between them considered
as ordered sequences.

Otherwise, it uses unittest.util.unorderable_list_difference, which
is essentially a multiset comparison.

In practice, I think the output from unorderable_list_difference is
usually more readable, so I wonder if something of that kind should be
made the default.


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))]


In general, I think that the 'first differing element' paragraph that
assertSequenceEqual produces is as likely to be misleading as it is to
be helpful (when we're really comparing unordered sequences).

--
messages: 117545
nosy: mattheww, michael.foord
priority: normal
severity: normal
status: open
title: TestCase.assertItemsEqual's description of differences
type: feature request

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9977] TestCase.assertItemsEqual's description of differences

2010-09-28 Thread Michael Foord

Changes by Michael Foord mich...@voidspace.org.uk:


--
assignee:  - michael.foord
components: +Library (Lib)
versions: +Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com