summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_userdict.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-05-02 09:06:28 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-05-02 09:06:28 (GMT)
commit91bbd9a7b9735cba07b06400a7c467aab6facfde (patch)
tree14bbad407135d461d54f8e1c066a93c6b9ef363d /Lib/test/test_userdict.py
parent40006e9f7a38bbbcf564c541cb0f2022b952e409 (diff)
downloadcpython-91bbd9a7b9735cba07b06400a7c467aab6facfde.zip
cpython-91bbd9a7b9735cba07b06400a7c467aab6facfde.tar.gz
cpython-91bbd9a7b9735cba07b06400a7c467aab6facfde.tar.bz2
Used sets.Set() to compare unordered sequences.
Improves clarity and brevity.
Diffstat (limited to 'Lib/test/test_userdict.py')
-rw-r--r--Lib/test/test_userdict.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
index bcf60a5..399ddda 100644
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -1,6 +1,7 @@
# Check every path through every method of UserDict
import test.test_support, unittest
+from sets import Set
import UserDict
@@ -68,10 +69,7 @@ class TestMappingProtocol(unittest.TestCase):
self.assert_(hasattr(iter, 'next'))
self.assert_(hasattr(iter, '__iter__'))
x = list(iter)
- x.sort()
- lst.sort()
- ref.sort()
- self.assert_(x==lst==ref)
+ self.assert_(Set(x)==Set(lst)==Set(ref))
check_iterandlist(d.iterkeys(), d.keys(), self.reference.keys())
check_iterandlist(iter(d), d.keys(), self.reference.keys())
check_iterandlist(d.itervalues(), d.values(), self.reference.values())
@@ -243,10 +241,8 @@ class UserDictTest(TestMappingProtocol):
ikeys = []
for k in u2:
ikeys.append(k)
- ikeys.sort()
keys = u2.keys()
- keys.sort()
- self.assertEqual(ikeys, keys)
+ self.assertEqual(Set(ikeys), Set(keys))
# Test setdefault
t = UserDict.UserDict()