[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2020-09-11 Thread Terry J. Reedy
Terry J. Reedy added the comment: Issue 38240 was closed as a duplicate of this. After reconsidering, I agree with leaving the name alone. Changing test assertXXX method names is a big nuisance, which we have done enough of. If one is using IDLE, >>> unittest.TestCase.assertCountEqual(

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2019-09-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > 1. It seems that the 'list' call should be irrelevant. It is relevant. Counter({1: 2}) != Counter(list({1: 2})). -- ___ Python tracker

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2019-09-21 Thread Terry J. Reedy
Terry J. Reedy added the comment: I like using 'multiset', but I think 'assertMultisetEqual', proposed by Martin Panter in msg266207, is better than assertMultiSetEqual, as it does not imply the existence of a class 'MultiSet'. Raymond's comment "distinct but equal values may appear on both

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2019-09-21 Thread Thomas Grainger
Thomas Grainger added the comment: While it may not appear to be a permutation, python already considers it one: graingert@onomastic:~$ cat test_assert_permutation.py import itertools import unittest from decimal import Decimal from fractions import Fraction class

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2019-09-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW "assertMultiSetEqual" may be better than "assertPermutation". The issue with the latter is that distinct but equal values may appear on both sides, so it isn't really a permutation. # These don't look like permutations at all # but they are

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2019-09-17 Thread Terry J. Reedy
Terry J. Reedy added the comment: In msg266115, Robert Collins suggested "add a different name and deprecate assertCountEqual". In msg266184, Gregory Smith said "not against adding a new name if it makes glorious sense, but we should not remove the old names from unittest as that causes

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2019-09-17 Thread Thomas Grainger
Change by Thomas Grainger : -- pull_requests: +15826 pull_request: https://github.com/python/cpython/pull/16228 ___ Python tracker ___

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2019-09-16 Thread Michael Foord
Michael Foord added the comment: I like assertPermutation (with or without the Is, slight preference for without). -- ___ Python tracker ___

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2019-09-15 Thread Thomas Grainger
Thomas Grainger added the comment: I think assertPermutation (without the "is") would be the best name -- ___ Python tracker ___

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2019-06-26 Thread Thomas Grainger
Thomas Grainger added the comment: How about assertIsPermutation? https://www.fluentcpp.com/2019/06/25/understanding-the-implementation-of-stdis_permutation/ -- nosy: +graingert ___ Python tracker

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2018-06-02 Thread Robert Collins
Robert Collins added the comment: So, I think we're in a local minima here. As I said earlier, neither the old nor new names really grab me, and I think everyone has aknowledged that the new name is -at best- confusing. We don't need *any more discussion* about that. The question is how to

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2018-06-01 Thread Alden
Alden added the comment: I think we need to re-open this issue. I have done a poll of a number of python developers and every developer I talked to said they initially thought this function "assertCountEqual" asserts that the count is equal. Probably because that's exactly what the words

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-24 Thread R. David Murray
R. David Murray added the comment: Agreed. Time to close the issue. If someone wants to do actual testing as Raymond suggests, and finds a name that actually works, they can either reopen this with a report or open a new issue. -- resolution: -> rejected stage: -> resolved status:

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: Further churning of the names will cause more harm than good. I recommend closing this (to end the bike-shedding and the stream of superlatives from the OP). This ship has sailed and users are already relying on the published API. Foord: "In the absence

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: assertSequenceEqualUnordered is not a good fit, because it doesn't follow the de facto naming convention, whereby "Equal" should be the suffix. Also assertSequenceEqualUnordered would be considered an oxymoron, since the word "Sequence" implies ordered, while

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Gregory P. Smith
Gregory P. Smith added the comment: assertSequenceEqualUnordered also works R. David. I was going to suggest that as well but edited it out to keep my suggestion simpler. :) I don't like the assertMultisetEqual suggestion as this is most notably an api having nothing to do with sets.

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Martin Panter
Martin Panter added the comment: assertMultisetEqual? -- nosy: +martin.panter ___ Python tracker ___ ___

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread R. David Murray
R. David Murray added the comment: how about assertSequenceEqualUnordered -- ___ Python tracker ___ ___

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Gregory P. Smith
Gregory P. Smith added the comment: assertUnorderedSequenceEqual would make more sense to me given the natural relation to assertSequenceEqual. We aren't dealing with sets (though sets are valid sequences) as this method specifically does not require sequence items to be hashable. Explicitly

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: I think that assertUnorderedEqual would contrast nicely with assertSequenceEqual -- ___ Python tracker ___

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: With missing last line, this time: == FAIL: test_equal_count_of_different_elements (__main__.Test) -- Traceback (most recent call

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: Same results on Python.org's Python 3.5.1 shell: >>> class Test(u.TestCase): ... def test_equal_count_of_same_elements(self): ... self.assertCountEqual(set([1,2,3]), set([1,2,3])) ... def test_equal_count_of_different_elements(self): ...

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: The preceding results are via Python 2.7.10 -- ___ Python tracker ___ ___

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: $ python assert_items_equal_test.py FF. == FAIL: test_different_count (__main__.Test) -- Traceback (most recent call last): File

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: Why do you say that "we aren't dealing with python sets"? Try: import unittest as u class Test(u.TestCase): def test_equal_count_of_same_elements(self): self.assertItemsEqual(set([1,2,3]), set([1,2,3])) def

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread R. David Murray
R. David Murray added the comment: And it suffers the same problem as 'unordered', or even more so, as it implies sets, but we aren't dealing with python sets. See why this is so tough? :) -- ___ Python tracker

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread R. David Murray
R. David Murray added the comment: Heh. We could call it 'assertQuotientSetEqual', but most people would have to look that up (I did, to find it). 'assertEquivalenceClassesEqual' is a bit better, but probably still not clear without looking it up (or being a mathematician). --

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: When I read "Unordered", it makes me think of collections, including sequences and sets. -- ___ Python tracker ___

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Gregory P. Smith
Gregory P. Smith added the comment: I'm not against adding a new name if it makes glorious sense, but we should not remove the old names from unittest as that causes unnecessary pain (based on past experience). assertCountEqual does make sense in terms of the "equivalent to" context from the

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +georg.brandl, gregory.p.smith, rhettinger ___ Python tracker ___

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: By leaps and bounds, I like assertUnorderedEqual versus assertCountEqual, which is terribly misleading. The first, and simplest, thing that comes to my mind from the word Count by itself is the count of all elements in a sequence (i.e., its length), certainly not

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: My first expectation for this function was assertUnorderedEqual, but I want to avoid problems with renaming (and coexisting of three names of for the same function), and I vote for status quo. -- nosy: +serhiy.storchaka

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread R. David Murray
R. David Murray added the comment: Vitaly: if you can come up with a name we agree is more descriptive than the current one by a non-trivial margin, we will be happy to listen. assertFrequencyCountsEqual is not sufficiently better. (Personally, I would not know what that function did by

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: Gentlemen, the point is that the name of a function should be all that is necessary to unambiguously understand what this method does without having to know that it's implemented in terms of collections.Counter or any other internal detail like that. That's not a

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Michael Foord
Michael Foord added the comment: I agree with David, I don't like the name but it is at least accurate (if you already understand what it does). assertItemsEqual was better but misleading. In the absence of a *dramatically* better name leave it alone. --

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread R. David Murray
R. David Murray added the comment: Personally I don't see any difference between assertCountsEqual and assertFrequencyCountsEqual. The logic for assertCountsEqual is that it is asserting that some counts are equal in this sequence. What could we be counting? The only obvious thing is the

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-23 Thread Vitaly
Vitaly added the comment: If there really is a good systemic reason why names like assertItemsEqual and assertElementsEqual are flawed, then assertFrequencyCountsEqual might be a less-ambiguous alternative. -- ___ Python tracker

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-22 Thread Vitaly
Vitaly added the comment: As far as I can tell, issue #10242 deals with the renaming. I think that the arguments for the new name are flawed (sorry to be so blunt, but I don't know how else to express it). Regardless of whether it's Count or Counts, to most people it sounds like it's going

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-22 Thread Robert Collins
Robert Collins added the comment: I don't particularly like either name FWIW :) - but sure, we can add a different name and deprecate assertCountEqual - but before we do anything lets look up the previous issue where the rename was done. -- ___

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-21 Thread SilentGhost
Changes by SilentGhost : -- nosy: +ezio.melotti, michael.foord, rbcollins type: -> behavior versions: -Python 3.3, Python 3.4, Python 3.5 ___ Python tracker

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-20 Thread Vitaly
Vitaly added the comment: The new name by itself does not sufficiently reflect the subtlety of element-by-element counts, which does a disservice to the readability of test code. And it's also an unnecessary incompatibility between 2.7 and 3.x. --

[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-20 Thread Vitaly
New submission from Vitaly: Somewhere in 3.x assertItemsEqual was renamed to assertCountEqual. assertCountEqual sounds like a really inappropriate, misleading name for what it does. It misleads users into thinking that it only compares the number of elements in each sequence, whereas it