summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-02-21 14:07:40 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-02-21 14:07:40 (GMT)
commite39ccef64c1c82dbfeecd7f624aa4d12b029986d (patch)
tree1bb8763137b006a1ab328847821c4d8e9a4b42a2 /Lib
parentb6596c516bcb4de4abf5722159d9aa3bff680173 (diff)
downloadcpython-e39ccef64c1c82dbfeecd7f624aa4d12b029986d.zip
cpython-e39ccef64c1c82dbfeecd7f624aa4d12b029986d.tar.gz
cpython-e39ccef64c1c82dbfeecd7f624aa4d12b029986d.tar.bz2
carefully don't depend on any dict order
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_gdb.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index 92e5c52..fe2c8e6 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -265,8 +265,14 @@ class PrettyPrintTests(DebuggerTests):
def test_sets(self):
'Verify the pretty-printing of sets'
self.assertGdbRepr(set())
- self.assertGdbRepr(set(['a', 'b']))
- self.assertGdbRepr(set([4, 5, 6]))
+ rep = self.get_gdb_repr("print set(['a', 'b'])")[0]
+ self.assertTrue(rep.startswith("set(["))
+ self.assertTrue(rep.endswith("])"))
+ self.assertEqual(eval(rep), {'a', 'b'})
+ rep = self.get_gdb_repr("print set([4, 5])")[0]
+ self.assertTrue(rep.startswith("set(["))
+ self.assertTrue(rep.endswith("])"))
+ self.assertEqual(eval(rep), {4, 5})
# Ensure that we handled sets containing the "dummy" key value,
# which happens on deletion:
@@ -278,8 +284,14 @@ print s''')
def test_frozensets(self):
'Verify the pretty-printing of frozensets'
self.assertGdbRepr(frozenset())
- self.assertGdbRepr("frozenset(['a', 'b'])")
- self.assertGdbRepr("frozenset([4, 5, 6])")
+ rep = self.get_gdb_repr("print frozenset(['a', 'b'])")[0]
+ self.assertTrue(rep.startswith("frozenset(["))
+ self.assertTrue(rep.endswith("])"))
+ self.assertEqual(eval(rep), {'a', 'b'})
+ rep = self.get_gdb_repr("print frozenset([4, 5])")[0]
+ self.assertTrue(rep.startswith("frozenset(["))
+ self.assertTrue(rep.endswith("])"))
+ self.assertEqual(eval(rep), {4, 5})
def test_exceptions(self):
# Test a RuntimeError