[pypy-commit] pypy py3k: fix test_constants on 32bit, by ignoring the L suffix that we get in python2 in the repr of longs

antocuni noreply at buildbot.pypy.org
Fri Jan 27 00:31:35 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r51831:c08972109bbb
Date: 2012-01-26 15:33 +0000
http://bitbucket.org/pypy/pypy/changeset/c08972109bbb/

Log:	fix test_constants on 32bit, by ignoring the L suffix that we get in
	python2 in the repr of longs

diff --git a/pypy/interpreter/astcompiler/test/test_compiler.py b/pypy/interpreter/astcompiler/test/test_compiler.py
--- a/pypy/interpreter/astcompiler/test/test_compiler.py
+++ b/pypy/interpreter/astcompiler/test/test_compiler.py
@@ -76,12 +76,15 @@
         w_res = pyco_expr.exec_host_bytecode(w_dict, w_dict)
         res = space.str_w(space.repr(w_res))
         expected_repr = self.get_py3_repr(expected)
-        if not isinstance(expected, float):
-            assert res == expected_repr
-        else:
+        if isinstance(expected, float):
             # Float representation can vary a bit between interpreter
             # versions, compare the numbers instead.
             assert eval(res) == expected
+        elif isinstance(expected, long):
+            assert expected_repr.endswith('L')
+            assert res == expected_repr[:-1] # in py3 we don't have the L suffix
+        else:
+            assert res == expected_repr
 
     def simple_test(self, source, evalexpr, expected):
         w_g = self.run(source)


More information about the pypy-commit mailing list