[Python-checkins] Use assertCountEqual instead of assertEqual. (GH-5223) (#5225)

Gregory P. Smith webhook-mailer at python.org
Wed Jan 17 18:51:30 EST 2018


https://github.com/python/cpython/commit/8d1e41d4148a69b0709fc7fb6bb733451ae1b28d
commit: 8d1e41d4148a69b0709fc7fb6bb733451ae1b28d
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Gregory P. Smith <greg at krypto.org>
date: 2018-01-17T15:51:27-08:00
summary:

Use assertCountEqual instead of assertEqual. (GH-5223) (#5225)

This test doesn't care about order, the underlying filesystem APIs do not
guarantee directory listings on subsequent calls will be in the same order.
(cherry picked from commit 3941499d6c2a4d09f2ea476f84b9c4ddc4bdefa0)

files:
M Lib/test/test_glob.py

diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py
index dce64f9fcb1..767bd3764b8 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -49,10 +49,10 @@ def glob(self, *parts, **kwargs):
             pattern = os.path.join(*parts)
         p = os.path.join(self.tempdir, pattern)
         res = glob.glob(p, **kwargs)
-        self.assertEqual(list(glob.iglob(p, **kwargs)), res)
+        self.assertCountEqual(glob.iglob(p, **kwargs), res)
         bres = [os.fsencode(x) for x in res]
-        self.assertEqual(glob.glob(os.fsencode(p), **kwargs), bres)
-        self.assertEqual(list(glob.iglob(os.fsencode(p), **kwargs)), bres)
+        self.assertCountEqual(glob.glob(os.fsencode(p), **kwargs), bres)
+        self.assertCountEqual(glob.iglob(os.fsencode(p), **kwargs), bres)
         return res
 
     def assertSequencesEqual_noorder(self, l1, l2):



More information about the Python-checkins mailing list