[Python-checkins] cpython (merge 3.2 -> default): Fix test_pprint random dict ordering.

florent.xicluna python-checkins at python.org
Sat Jul 21 12:45:20 CEST 2012


http://hg.python.org/cpython/rev/79d44f4920d9
changeset:   78215:79d44f4920d9
parent:      78213:4d0dcfbdf45b
parent:      78214:29642f82bbcc
user:        Florent Xicluna <florent.xicluna at gmail.com>
date:        Sat Jul 21 12:45:02 2012 +0200
summary:
  Fix test_pprint random dict ordering.

files:
  Lib/test/test_pprint.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py
--- a/Lib/test/test_pprint.py
+++ b/Lib/test/test_pprint.py
@@ -471,8 +471,9 @@
                          '{1: 0, ' + repr(Unorderable) +': 0}')
 
         # Issue 14998: TypeError on tuples with NoneTypes as dict keys.
-        self.assertEqual(pprint.pformat({(1,): 0, (None,): 0}),
-                         '{(1,): 0, (None,): 0}')
+        keys = [(1,), (None,)]
+        self.assertEqual(pprint.pformat(dict.fromkeys(keys, 0)),
+                         '{%r: 0, %r: 0}' % tuple(sorted(keys, key=id)))
 
 
 class DottedPrettyPrinter(pprint.PrettyPrinter):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list