Thomas Grainger <tagr...@gmail.com> 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 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@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue27071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to