[issue27071] unittest.TestCase.assertCountEqual is a very misleading name
Thomas Grainger
report at bugs.python.org
Sat Sep 21 05:55:01 EDT 2019
Thomas Grainger <tagrain at gmail.com> added the comment:
While it may not appear to be a permutation, python already considers it one:
graingert at onomastic:~$ cat test_assert_permutation.py
import itertools
import unittest
from decimal import Decimal
from fractions import Fraction
class TestAssertPermutation(unittest.TestCase):
def assertPermutation(self, a, b):
return self.assertIn(tuple(a), itertools.permutations(b))
def test_do_not_look_like_permutations(self):
self.assertPermutation(
[Decimal(3), 5, Fraction(12, 4)], [3.0, 3, Fraction(15, 3)]
)
if __name__ == "__main__":
unittest.main()
graingert at onomastic:~$ python3 test_assert_permutation.py -v
test_do_not_look_like_permutations (__main__.TestAssertPermutation) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue27071>
_______________________________________
More information about the Python-bugs-list
mailing list