[pypy-svn] pypy default: This is an issue of dictionary ordering.

arigo commits-noreply at bitbucket.org
Sun Feb 6 15:57:42 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41656:edba34cc68ff
Date: 2011-02-06 15:57 +0100
http://bitbucket.org/pypy/pypy/changeset/edba34cc68ff/

Log:	This is an issue of dictionary ordering.

diff --git a/lib-python/2.7.0/test/test_pprint.py b/lib-python/modified-2.7.0/test/test_pprint.py
copy from lib-python/2.7.0/test/test_pprint.py
copy to lib-python/modified-2.7.0/test/test_pprint.py
--- a/lib-python/2.7.0/test/test_pprint.py
+++ b/lib-python/modified-2.7.0/test/test_pprint.py
@@ -233,7 +233,16 @@
                                   frozenset([0, 2]),
                                   frozenset([0, 1])])}"""
         cube = test.test_set.cube(3)
-        self.assertEqual(pprint.pformat(cube), cube_repr_tgt)
+        # XXX issues of dictionary order, and for the case below,
+        # order of items in the frozenset([...]) representation.
+        # Whether we get precisely cube_repr_tgt or not is open
+        # to implementation-dependent choices (this test probably
+        # fails horribly in CPython if we tweak the dict order too).
+        got = pprint.pformat(cube)
+        if test.test_support.impl_detail(cpython=True):
+            self.assertEqual(got, cube_repr_tgt)
+        else:
+            self.assertEqual(eval(got), cube)
         cubo_repr_tgt = """\
 {frozenset([frozenset([0, 2]), frozenset([0])]): frozenset([frozenset([frozenset([0,
                                                                                   2]),
@@ -393,7 +402,11 @@
                                                                                         2])])])}"""
 
         cubo = test.test_set.linegraph(cube)
-        self.assertEqual(pprint.pformat(cubo), cubo_repr_tgt)
+        got = pprint.pformat(cubo)
+        if test.test_support.impl_detail(cpython=True):
+            self.assertEqual(got, cubo_repr_tgt)
+        else:
+            self.assertEqual(eval(got), cubo)
 
     def test_depth(self):
         nested_tuple = (1, (2, (3, (4, (5, 6)))))


More information about the Pypy-commit mailing list