summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_grammar.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-10-10 01:45:02 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-10-10 01:45:02 (GMT)
commit7d3dff2b390272dec07ca687f53ad34bd00df39b (patch)
treec2c75646464187ee7c8200e94400871a7642907d /Lib/test/test_grammar.py
parente67dab3d3f9ffafb5668aab509abbd6c84f5ff35 (diff)
downloadcpython-7d3dff2b390272dec07ca687f53ad34bd00df39b.zip
cpython-7d3dff2b390272dec07ca687f53ad34bd00df39b.tar.gz
cpython-7d3dff2b390272dec07ca687f53ad34bd00df39b.tar.bz2
SF patch [ #468662 ] Allow jython to complete test_grammar
The behavior of co_varnames in the presence of nested argument tuples is not consistent across Python and Jython. Test each platform separately.
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r--Lib/test/test_grammar.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index 7ce8a79..da3dad5 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -2,6 +2,7 @@
# This just tests whether the parser accepts them all.
from test_support import *
+import sys
print '1. Parser'
@@ -149,16 +150,25 @@ def f4(two, (compound, (argument, list))): pass
def f5((compound, first), two): pass
verify(f2.func_code.co_varnames == ('one_argument',))
verify(f3.func_code.co_varnames == ('two', 'arguments'))
-verify(f4.func_code.co_varnames == ('two', '.2', 'compound', 'argument',
- 'list'))
-verify(f5.func_code.co_varnames == ('.0', 'two', 'compound', 'first'))
+if sys.platform.startswith('java'):
+ verify(f4.func_code.co_varnames ==
+ ('two', '(compound, (argument, list))',))
+ verify(f5.func_code.co_varnames ==
+ ('(compound, first)', 'two', 'compound', 'first'))
+else:
+ verify(f4.func_code.co_varnames == ('two', '.2', 'compound',
+ 'argument', 'list'))
+ verify(f5.func_code.co_varnames == ('.0', 'two', 'compound', 'first'))
def a1(one_arg,): pass
def a2(two, args,): pass
def v0(*rest): pass
def v1(a, *rest): pass
def v2(a, b, *rest): pass
def v3(a, (b, c), *rest): return a, b, c, rest
-verify(v3.func_code.co_varnames == ('a', '.2', 'rest', 'b', 'c'))
+if sys.platform.startswith('java'):
+ verify(v3.func_code.co_varnames == ('a', '(b, c)', 'rest', 'b', 'c'))
+else:
+ verify(v3.func_code.co_varnames == ('a', '.2', 'rest', 'b', 'c'))
verify(v3(1, (2, 3), 4) == (1, 2, 3, (4,)))
def d01(a=1): pass
d01()