From: <pj...@us...> - 2008-12-06 09:02:57
|
Revision: 5714 http://jython.svn.sourceforge.net/jython/?rev=5714&view=rev Author: pjenvey Date: 2008-12-06 09:02:53 +0000 (Sat, 06 Dec 2008) Log Message: ----------- revert the astlist workaround as it subclasses list now Modified Paths: -------------- trunk/jython/Lib/test/test_ast.py Modified: trunk/jython/Lib/test/test_ast.py =================================================================== --- trunk/jython/Lib/test/test_ast.py 2008-12-06 06:55:48 UTC (rev 5713) +++ trunk/jython/Lib/test/test_ast.py 2008-12-06 09:02:53 UTC (rev 5714) @@ -5,7 +5,7 @@ def to_tuple(t): if t is None or isinstance(t, (basestring, int, long, complex)): return t - elif hasattr(t, "__iter__"): + elif isinstance(t, list): return [to_tuple(e) for e in t] result = [t.__class__.__name__] if hasattr(t, 'lineno') and hasattr(t, 'col_offset'): @@ -131,7 +131,7 @@ parent_pos = (ast_node.lineno, ast_node.col_offset) for name in ast_node._fields: value = getattr(ast_node, name) - if hasattr(value, "__iter__"): + if isinstance(value, list): for child in value: self._assert_order(child, parent_pos) elif value is not None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-08-16 02:51:14
|
Revision: 6672 http://jython.svn.sourceforge.net/jython/?rev=6672&view=rev Author: fwierzbicki Date: 2009-08-16 02:51:07 +0000 (Sun, 16 Aug 2009) Log Message: ----------- Bugfix for test ast generation code. Modified Paths: -------------- trunk/jython/Lib/test/test_ast.py Modified: trunk/jython/Lib/test/test_ast.py =================================================================== --- trunk/jython/Lib/test/test_ast.py 2009-08-16 02:49:27 UTC (rev 6671) +++ trunk/jython/Lib/test/test_ast.py 2009-08-16 02:51:07 UTC (rev 6672) @@ -297,7 +297,7 @@ print kind+"_results = [" for s in statements: print repr(to_tuple(compile(s, "?", kind, 0x400)))+"," - print "]" + print "]" print "main()" raise SystemExit test_main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-08-16 02:55:32
|
Revision: 6673 http://jython.svn.sourceforge.net/jython/?rev=6673&view=rev Author: fwierzbicki Date: 2009-08-16 02:55:25 +0000 (Sun, 16 Aug 2009) Log Message: ----------- Added tests for BoolOp and parens. Modified Paths: -------------- trunk/jython/Lib/test/test_ast.py Modified: trunk/jython/Lib/test/test_ast.py =================================================================== --- trunk/jython/Lib/test/test_ast.py 2009-08-16 02:51:07 UTC (rev 6672) +++ trunk/jython/Lib/test/test_ast.py 2009-08-16 02:55:25 UTC (rev 6673) @@ -64,6 +64,9 @@ "break", # Continue "continue", + # Parens and BoolOp + "(a == '') and b", + "not (a == '') or b", ] # These are compiled through "single" @@ -326,6 +329,8 @@ ('Module', [('Pass', (1, 0))]), ('Module', [('Break', (1, 0))]), ('Module', [('Continue', (1, 0))]), +('Module', [('Expr', (1, 0), ('BoolOp', (1, 0), ('And',), [('Compare', (1, 1), ('Name', (1, 1), 'a', ('Load',)), [('Eq',)], [('Str', (1, 6), '')]), ('Name', (1, 14), 'b', ('Load',))]))]), +('Module', [('Expr', (1, 0), ('BoolOp', (1, 0), ('Or',), [('UnaryOp', (1, 0), ('Not',), ('Compare', (1, 5), ('Name', (1, 5), 'a', ('Load',)), [('Eq',)], [('Str', (1, 10), '')])), ('Name', (1, 17), 'b', ('Load',))]))]), ] single_results = [ ('Interactive', [('Expr', (1, 0), ('BinOp', (1, 0), ('Num', (1, 0), 1), ('Add',), ('Num', (1, 2), 2)))]), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-08-17 02:29:41
|
Revision: 6688 http://jython.svn.sourceforge.net/jython/?rev=6688&view=rev Author: fwierzbicki Date: 2009-08-17 02:29:34 +0000 (Mon, 17 Aug 2009) Log Message: ----------- Added ast tests for "naked tuples" in for statements like: for a,b in c: pass Modified Paths: -------------- trunk/jython/Lib/test/test_ast.py Modified: trunk/jython/Lib/test/test_ast.py =================================================================== --- trunk/jython/Lib/test/test_ast.py 2009-08-17 01:47:30 UTC (rev 6687) +++ trunk/jython/Lib/test/test_ast.py 2009-08-17 02:29:34 UTC (rev 6688) @@ -67,6 +67,11 @@ # Parens and BoolOp "(a == '') and b", "not (a == '') or b", + # for statements with naked tuples + "for a,b in c: pass", + "[(a,b) for a,b in c]", + "((a,b) for a,b in c)", + ] # These are compiled through "single" @@ -331,6 +336,9 @@ ('Module', [('Continue', (1, 0))]), ('Module', [('Expr', (1, 0), ('BoolOp', (1, 0), ('And',), [('Compare', (1, 1), ('Name', (1, 1), 'a', ('Load',)), [('Eq',)], [('Str', (1, 6), '')]), ('Name', (1, 14), 'b', ('Load',))]))]), ('Module', [('Expr', (1, 0), ('BoolOp', (1, 0), ('Or',), [('UnaryOp', (1, 0), ('Not',), ('Compare', (1, 5), ('Name', (1, 5), 'a', ('Load',)), [('Eq',)], [('Str', (1, 10), '')])), ('Name', (1, 17), 'b', ('Load',))]))]), +('Module', [('For', (1, 0), ('Tuple', (1, 4), [('Name', (1, 4), 'a', ('Store',)), ('Name', (1, 6), 'b', ('Store',))], ('Store',)), ('Name', (1, 11), 'c', ('Load',)), [('Pass', (1, 14))], [])]), +('Module', [('Expr', (1, 0), ('ListComp', (1, 1), ('Tuple', (1, 2), [('Name', (1, 2), 'a', ('Load',)), ('Name', (1, 4), 'b', ('Load',))], ('Load',)), [('comprehension', ('Tuple', (1, 11), [('Name', (1, 11), 'a', ('Store',)), ('Name', (1, 13), 'b', ('Store',))], ('Store',)), ('Name', (1, 18), 'c', ('Load',)), [])]))]), +('Module', [('Expr', (1, 0), ('GeneratorExp', (1, 1), ('Tuple', (1, 2), [('Name', (1, 2), 'a', ('Load',)), ('Name', (1, 4), 'b', ('Load',))], ('Load',)), [('comprehension', ('Tuple', (1, 11), [('Name', (1, 11), 'a', ('Store',)), ('Name', (1, 13), 'b', ('Store',))], ('Store',)), ('Name', (1, 18), 'c', ('Load',)), [])]))]), ] single_results = [ ('Interactive', [('Expr', (1, 0), ('BinOp', (1, 0), ('Num', (1, 0), 1), ('Add',), ('Num', (1, 2), 2)))]), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |