Use assertCountEqual instead of assertEqual. (#5223)

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.
This commit is contained in:
Gregory P. Smith 2018-01-17 14:57:57 -08:00 committed by GitHub
parent e860089fd9
commit 3941499d6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

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):