[pypy-svn] r16539 - pypy/dist/pypy/interpreter/pyparser/test

arigo at codespeak.net arigo at codespeak.net
Thu Aug 25 19:53:03 CEST 2005


Author: arigo
Date: Thu Aug 25 19:53:02 2005
New Revision: 16539

Modified:
   pypy/dist/pypy/interpreter/pyparser/test/test_samples.py
Log:
'snippet_transformer_bug.py' exposes a bug with the CPython
compiler.transformer module, which we fixed.  So we can't compare the output
of CPython with ours any more for this test.  Tentatively, I Hard-coded the
expected result in test_sample.py.


Modified: pypy/dist/pypy/interpreter/pyparser/test/test_samples.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/test/test_samples.py	(original)
+++ pypy/dist/pypy/interpreter/pyparser/test/test_samples.py	Thu Aug 25 19:53:02 2005
@@ -21,6 +21,11 @@
     #"snippet_import_statements.py",
     "snippet_decorators.py",
 ]
+REAL_EXPECTED_OUTPUT = {
+    # for snippets that show bugs of Python's compiler package
+    "snippet_transformer_bug.py":
+        "Module('This module does nothing', Stmt([Printnl([Const(1)], None)]))",
+    }
 
 
 def name(elt):
@@ -96,11 +101,17 @@
     # differences -- typically newlines at the end of the tree.
     print 'Comparing the ASTs of', testname
     transformer1 = PyPyTransformer()
-    transformer2 = PythonTransformer()
     ast_pypy   = transformer1.compile_node(pypy_tuples)
-    ast_python = transformer2.compile_node(python_tuples)
-    repr_pypy   = repr(ast_pypy)
-    repr_python = repr(ast_python)
+    repr_pypy  = repr(ast_pypy)
+
+    key = os.path.basename(testname)
+    if key not in REAL_EXPECTED_OUTPUT:
+        transformer2 = PythonTransformer()
+        ast_python = transformer2.compile_node(python_tuples)
+        repr_python = repr(ast_python)
+    else:
+        repr_python = REAL_EXPECTED_OUTPUT[key]
+
     if GRAMMAR_MISMATCH:
         # XXX hack:
         # hide the more common difference between 2.3 and 2.4, which is



More information about the Pypy-commit mailing list