summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_repr.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-09-12 19:00:10 (GMT)
committerGeorg Brandl <georg@python.org>2007-09-12 19:00:10 (GMT)
commitfed6bb7d7061f940c4fe4ed43526ea5bbf968de2 (patch)
treebdba37e297d643c200e406e08f9dcab6a9b9fc2f /Lib/test/test_repr.py
parent226910f52d94beededad90e9de644c0da663d72a (diff)
downloadcpython-fed6bb7d7061f940c4fe4ed43526ea5bbf968de2.zip
cpython-fed6bb7d7061f940c4fe4ed43526ea5bbf968de2.tar.gz
cpython-fed6bb7d7061f940c4fe4ed43526ea5bbf968de2.tar.bz2
Bug #1153: repr.repr() now doesn't require set and dictionary items
to be orderable to properly represent them. (backport from rev. 58122)
Diffstat (limited to 'Lib/test/test_repr.py')
-rw-r--r--Lib/test/test_repr.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py
index 9f03a16..d23cf4d 100644
--- a/Lib/test/test_repr.py
+++ b/Lib/test/test_repr.py
@@ -197,6 +197,16 @@ class ReprTests(unittest.TestCase):
x = classmethod(C.foo)
self.failUnless(repr(x).startswith('<classmethod object at 0x'))
+ def test_unsortable(self):
+ # Repr.repr() used to call sorted() on sets, frozensets and dicts
+ # without taking into account that not all objects are comparable
+ x = set([1j, 2j, 3j])
+ y = frozenset(x)
+ z = {1j: 1, 2j: 2}
+ r(x)
+ r(y)
+ r(z)
+
def touch(path, text=''):
fp = open(path, 'w')
fp.write(text)