[Python-checkins] Use assertItemsEqual instead of assertEqual. (#5224)
Gregory P. Smith
webhook-mailer at python.org
Wed Jan 17 18:15:50 EST 2018
https://github.com/python/cpython/commit/b1a52b11673f6fd29b357852977282c8b41cfb7d
commit: b1a52b11673f6fd29b357852977282c8b41cfb7d
branch: 2.7
author: Gregory P. Smith <greg at krypto.org>
committer: GitHub <noreply at github.com>
date: 2018年01月17日T15:15:46-08:00
summary:
Use assertItemsEqual instead of assertEqual. (#5224)
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.
files:
M Lib/test/test_glob.py
diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py
index b360d09dfa6..84b2e7ddd25 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -49,10 +49,10 @@ def glob(self, *parts):
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):
More information about the Python-checkins
mailing list