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 3941499d6c)
This commit is contained in:
Miss Islington (bot) 2018-01-17 15:51:27 -08:00 committed by Gregory P. Smith
parent 4e09c0c858
commit 8d1e41d414

View file

@ -49,10 +49,10 @@ class GlobTests(unittest.TestCase):
pattern = os.path.join(*parts) pattern = os.path.join(*parts)
p = os.path.join(self.tempdir, pattern) p = os.path.join(self.tempdir, pattern)
res = glob.glob(p, **kwargs) 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] bres = [os.fsencode(x) for x in res]
self.assertEqual(glob.glob(os.fsencode(p), **kwargs), bres) self.assertCountEqual(glob.glob(os.fsencode(p), **kwargs), bres)
self.assertEqual(list(glob.iglob(os.fsencode(p), **kwargs)), bres) self.assertCountEqual(glob.iglob(os.fsencode(p), **kwargs), bres)
return res return res
def assertSequencesEqual_noorder(self, l1, l2): def assertSequencesEqual_noorder(self, l1, l2):