[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2020-09-11 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions: +Python 3.10 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2020-09-11 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Vitaly, when you repost to posts by email, please delete the post you are 
responding to, expect possible for a particular line.  The full post is already 
here on the web page above the response, and a duplicate copy is just noise 
that wastes screen space.

--
nosy: +terry.reedy
versions:  -Python 3.5, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2020-09-05 Thread Vitaly Kruglikov


Vitaly Kruglikov  added the comment:

Well, when you do tab-completion in unit tests on `self.` and
`assertCountEqual` pops up, it sure sounds a lot like it's going to compare
just the count of the items. The point is that the name of the function is
not self-documenting, hence "misleading".

A better name could be `assertItemsEqual` or `assertCountAndItemsEqual`

On Sat, Sep 5, 2020 at 1:02 PM Raymond Hettinger 
wrote:

>
> Raymond Hettinger  added the comment:
>
> This should stay closed as a duplicate.
>
> If you must, reopen of the original 27071, but it was closed for a
> reason.  The majority of respondents voted for the status quo.  Each
> alternative that was considered had its own share of problems.
>
> BTW, it is hyperbolic to call the name "horribly misleading".  The method
> literally runs Counter and checks for equality.  The docstring is clear
> about this:
>
> def assertCountEqual(self, first, second, msg=None):
> """Asserts that two iterables have the same elements, the same
> number of
> times, without regard to order.
>
> self.assertEqual(Counter(list(first)),
>  Counter(list(second)))
>
>  Example:
> - [0, 1, 1] and [1, 0, 1] compare equal.
> - [0, 0, 1] and [0, 1] compare unequal.
>
> """
>
> --
> nosy: +rhettinger
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2020-09-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This should stay closed as a duplicate.

If you must, reopen of the original 27071, but it was closed for a reason.  The 
majority of respondents voted for the status quo.  Each alternative that was 
considered had its own share of problems.

BTW, it is hyperbolic to call the name "horribly misleading".  The method 
literally runs Counter and checks for equality.  The docstring is clear about 
this:

def assertCountEqual(self, first, second, msg=None):
"""Asserts that two iterables have the same elements, the same number of
times, without regard to order.

self.assertEqual(Counter(list(first)),
 Counter(list(second)))

 Example:
- [0, 1, 1] and [1, 0, 1] compare equal.
- [0, 0, 1] and [0, 1] compare unequal.

"""

--
nosy: +rhettinger
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2020-09-05 Thread Vitaly Kruglikov


Vitaly Kruglikov  added the comment:

Reopened per request from ammar2

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2020-09-05 Thread Vitaly Kruglikov


Vitaly Kruglikov  added the comment:

Re-opened, thanks!

On Fri, Sep 20, 2019 at 3:01 PM Ammar Askar  wrote:

>
> Ammar Askar  added the comment:
>
> Hey Vitaly, not sure if you're the author of the original bug here:
> https://bugs.python.org/issue27071
>
> Could you re-open that so the discussion is kept in one place.
>
> --
> nosy: +ammar2
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2020-09-05 Thread Vitaly Kruglikov


Change by Vitaly Kruglikov :


--
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2020-09-04 Thread Mark Dickinson


Change by Mark Dickinson :


--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

Hey Vitaly, not sure if you're the author of the original bug here: 
https://bugs.python.org/issue27071

Could you re-open that so the discussion is kept in one place.

--
nosy: +ammar2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2019-09-20 Thread Ammar Askar


Change by Ammar Askar :


--
resolution:  -> duplicate
stage:  -> resolved
superseder:  -> unittest.TestCase.assertCountEqual is a very misleading name
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2019-09-20 Thread Vitaly Kruglikov


New submission from Vitaly Kruglikov :

assertCountEqual is a horribly misleading name because it misleads the 
programmer and reader of the test code into thinking that it only compares the 
counts of the elements.

It's name misrepresents what it does in a really bad way.

--
components: Tests
messages: 352901
nosy: vitaly.krug
priority: normal
severity: normal
status: open
title: assertCountEqual is horribly misleading, sounds like only counts are 
being compared
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com