[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2013-04-29 Thread Florent Xicluna
Changes by Florent Xicluna : -- nosy: +flox ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2011-03-16 Thread Ezio Melotti
Changes by Ezio Melotti : -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2011-03-16 Thread Michael Foord
Michael Foord added the comment: Fixes backported to assertItemsEqual in 2.7. -- resolution: -> fixed stage: -> committed/rejected ___ Python tracker ___ _

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2011-03-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset d8eaeee1c063 by Michael Foord in branch '2.7': Issue #10242: backport of more fixes to unittest.TestCase.assertItemsEqual http://hg.python.org/cpython/rev/d8eaeee1c063 -- nosy: +python-dev ___ Python tra

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2011-03-16 Thread Michael Foord
Michael Foord added the comment: I need to check that the implementation has been backported to 2.7 completely / correctly. Raymond made some changes (output format and a bugfix) that may not have been backported yet. -- ___ Python tracker

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2011-03-15 Thread Gregory P. Smith
Gregory P. Smith added the comment: assertCountEqual has been released in 3.2 as the new name. close this? -- ___ Python tracker ___ ___

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2011-01-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: The improved output format in 3.2 still needs to be backported to 2.7. -- priority: normal -> low versions: -Python 3.2 ___ Python tracker

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-12-21 Thread Michael Foord
Michael Foord added the comment: This is committed to 2.7 and 3.2 (using the old name assertItemsEqual in 2.7). As we're well into the beta cycle I don't think we can change the name in 3.2. The current failure output is very nice for comparing sequences like [1, 2, 3] vs [1, 2, 4]: Assertio

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-12-19 Thread Michael Foord
Michael Foord added the comment: Improved implementation committed to 2.7 revision 87407. Method name unchanged there. -- ___ Python tracker ___ ___

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-12-09 Thread Gregory P. Smith
Gregory P. Smith added the comment: I have to agree that the name assertCountEqual does not work well for me as something I can read and really comprehend what it is going to do without searching for the docs or implementation to double check. (not that assertItemsEqual did either). 'Count'

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-29 Thread Georg Brandl
Georg Brandl added the comment: ISTM that the new name is worse than the old name. I hadn't followed this issue, heard assertCountEqual the first time today, and couldn't guess what it does. I'd have assumed that it checks only for equality of the number of items in a sequence, not for equa

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: Attaching possible code for nicer output. -- assignee: rhettinger -> michael.foord resolution: fixed -> Added file: http://bugs.python.org/file19833/nice_output.diff ___ Python tracker

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: Applied in r86828. The output could still be made nicer, perhaps something along the lines of: expected 6, got 4: 'wand of fireballs' expected 2, got 7: 'ring of invisibility' . . . -- priority: high -> normal resolution: -> fixed _

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-25 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: michael.foord -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-20 Thread Mark Roddy
Mark Roddy added the comment: Adding patch for release27-maint branch which implements Raymond's suggested fix which utilizes collections.Counter. Has the same issues addressed with the py3k patch. -- Added file: http://bugs.python.org/file19721/py27.10242.patch ___

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-20 Thread Mark Roddy
Mark Roddy added the comment: Adding patch for py3k which implements Raymond's suggested fix which utilizes collections.Counter. Have not changed the name of the assertion method as this seems as though it may be outside the scope of this issue, but I can produce another patch with the nam

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: One nuance, it may be better to implement as: a_cnt = collections.Counter(iter(a)) b_cnt = collections.Counter(iter(b)) That will bypass the special handling the Counter constructor has if the argument is a Mapping. --

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-03 Thread Michael Foord
Michael Foord added the comment: assertElementCountEqual is good name and I like your implementation suggestion. I'll put this in. I think the implementation fix can go into 2.7 as well but not the rename/aliasing. -- ___ Python tracker

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I'd be inclined to insert a check that falls back > to the "unorderable_list_difference" approach in > the case where "expected != sorted(reversed(expected))". Too fragile and subtle. The method need to be absolutely straight-forward. -- _

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Suggestions: * new name: assertCountEqual(a, b) or:assertElementCountEqual(a, b) this name captures the essential service: - unordered comparison where duplicates matter - inputs are "elements", not "items" which means key/value pairs

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-01 Thread Michael Foord
Michael Foord added the comment: On Python-dev Nick Coghlan suggests a fix for the fast-path that would allow us to keep it whilst fixing this bug (not tested yet but adding this note not to lose it). The issue of the name of this method is in 10273. Looking at assertItemsEqual, I'd be incli

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-10-31 Thread Michael Foord
Michael Foord added the comment: As this has been released in 2.7 (and unittest2) I don't think it can be just removed in 3.2 - it would make porting code from Python 2 to 3 more painful. Very happy for you to fix in Python 2.7. Please let me know when it goes in so that I can keep unittest2

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-10-31 Thread Michael Foord
Changes by Michael Foord : -- assignee: rhettinger -> michael.foord ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-10-31 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'll fix this in 2.7. For 3.2, may remove the method entirely (for the reasons discussed on python-dev). -- assignee: michael.foord -> rhettinger ___ Python tracker _

[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-10-29 Thread Raymond Hettinger
New submission from Raymond Hettinger : class T(unittest.TestCase): def test_items_equal(self): # this test fails, but should succeed a = [{2,4}, {1,2}] b = a[::-1] self.assertItemsEqual(a, b) This method has a fast-path using sorted() and a slow-path that doe