Commit e39ccef6 authored by Benjamin Peterson's avatar Benjamin Peterson

carefully don't depend on any dict order

parent b6596c51
...@@ -265,8 +265,14 @@ class PrettyPrintTests(DebuggerTests): ...@@ -265,8 +265,14 @@ class PrettyPrintTests(DebuggerTests):
def test_sets(self): def test_sets(self):
'Verify the pretty-printing of sets' 'Verify the pretty-printing of sets'
self.assertGdbRepr(set()) self.assertGdbRepr(set())
self.assertGdbRepr(set(['a', 'b'])) rep = self.get_gdb_repr("print set(['a', 'b'])")[0]
self.assertGdbRepr(set([4, 5, 6])) 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, # Ensure that we handled sets containing the "dummy" key value,
# which happens on deletion: # which happens on deletion:
...@@ -278,8 +284,14 @@ print s''') ...@@ -278,8 +284,14 @@ print s''')
def test_frozensets(self): def test_frozensets(self):
'Verify the pretty-printing of frozensets' 'Verify the pretty-printing of frozensets'
self.assertGdbRepr(frozenset()) self.assertGdbRepr(frozenset())
self.assertGdbRepr("frozenset(['a', 'b'])") rep = self.get_gdb_repr("print frozenset(['a', 'b'])")[0]
self.assertGdbRepr("frozenset([4, 5, 6])") 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): def test_exceptions(self):
# Test a RuntimeError # Test a RuntimeError
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment