[pypy-svn] r16385 - in pypy/dist/pypy/interpreter/pyparser/test: . samples
ludal at codespeak.net
ludal at codespeak.net
Wed Aug 24 15:46:17 CEST 2005
Author: ludal
Date: Wed Aug 24 15:46:15 2005
New Revision: 16385
Added:
pypy/dist/pypy/interpreter/pyparser/test/samples/snippet_transformer_bug.py
Modified:
pypy/dist/pypy/interpreter/pyparser/test/samples/snippet_docstring.py
pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py
Log:
- a bug in transformer.py drops statement after a docstring like that :
"""hello""";print 1
- astbuilder works correctly so we just add some test cases to remember the bug
- also fix a bug in test_astbuilder recursive comparison of ast trees
Modified: pypy/dist/pypy/interpreter/pyparser/test/samples/snippet_docstring.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/test/samples/snippet_docstring.py (original)
+++ pypy/dist/pypy/interpreter/pyparser/test/samples/snippet_docstring.py Wed Aug 24 15:46:15 2005
@@ -14,4 +14,7 @@
def foo(self):
"""function docstring"""
+def boo(x):
+ """Docstring""";print 1
+
"""world"""
Added: pypy/dist/pypy/interpreter/pyparser/test/samples/snippet_transformer_bug.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/interpreter/pyparser/test/samples/snippet_transformer_bug.py Wed Aug 24 15:46:15 2005
@@ -0,0 +1,2 @@
+"""This module does nothing""";print 1
+
Modified: pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py (original)
+++ pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py Wed Aug 24 15:46:15 2005
@@ -54,9 +54,21 @@
del right_nodes[0]
if not arglist_equal(left_args, right_args):
return False
+ elif isinstance(left,stable_ast.Const):
+ if isinstance(right,ast_ast.NoneConst):
+ return left.value == None
+ elif isinstance(right, ast_ast.NumberConst):
+ return left.value == right.number_value
+ elif isinstance(right, ast_ast.StringConst):
+ return left.value == right.string_value
+ else:
+ print "Not const type %s" % repr(right)
+ return False
else:
left_nodes = left.getChildren()
right_nodes = right.getChildren()
+ if len(left_nodes)!=len(right_nodes):
+ return False
for i,j in zip(left_nodes,right_nodes):
if not nodes_equal(i,j):
return False
@@ -384,7 +396,12 @@
a = 1
"""bar"""
return a
- '''
+ ''',
+ '''def foo():
+ """doc"""; print 1
+ a=1
+ ''',
+ '''"""Docstring""";print 1''',
]
returns = [
More information about the Pypy-commit
mailing list