]> granicus.if.org Git - python/commitdiff
Use assertItemsEqual instead of assertEqual. (#5224)
authorGregory P. Smith <greg@krypto.org>
Wed, 17 Jan 2018 23:15:46 +0000 (15:15 -0800)
committerGitHub <noreply@github.com>
Wed, 17 Jan 2018 23:15:46 +0000 (15:15 -0800)
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.

Lib/test/test_glob.py

index b360d09dfa6de96eb39278f13c0b23c7762a83b3..84b2e7ddd258d8cbc6abf5f060d45efd66290f26 100644 (file)
@@ -49,10 +49,10 @@ class GlobTests(unittest.TestCase):
             pattern = os.path.join(*parts)
         p = os.path.join(self.tempdir, pattern)
         res = glob.glob(p)
-        self.assertEqual(list(glob.iglob(p)), res)
+        self.assertItemsEqual(glob.iglob(p), res)
         ures = [fsdecode(x) for x in res]
-        self.assertEqual(glob.glob(fsdecode(p)), ures)
-        self.assertEqual(list(glob.iglob(fsdecode(p))), ures)
+        self.assertItemsEqual(glob.glob(fsdecode(p)), ures)
+        self.assertItemsEqual(glob.iglob(fsdecode(p)), ures)
         return res
 
     def assertSequencesEqual_noorder(self, l1, l2):