[Python-checkins] CVS: python/dist/src/Lib/test test_grammar.py,1.38,1.39

Jeremy Hylton jhylton@users.sourceforge.net
Tue, 09 Oct 2001 18:45:04 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv20923

Modified Files:
	test_grammar.py 
Log Message:
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.



Index: test_grammar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** test_grammar.py	2001/09/26 12:43:38	1.38
--- test_grammar.py	2001/10/10 01:45:02	1.39
***************
*** 3,6 ****
--- 3,7 ----
  
  from test_support import *
+ import sys
  
  print '1. Parser'
***************
*** 150,156 ****
  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'))
  def a1(one_arg,): pass
  def a2(two, args,): pass
--- 151,163 ----
  verify(f2.func_code.co_varnames == ('one_argument',))
  verify(f3.func_code.co_varnames == ('two', 'arguments'))
! 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
***************
*** 159,163 ****
  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'))
  verify(v3(1, (2, 3), 4) == (1, 2, 3, (4,)))
  def d01(a=1): pass
--- 166,173 ----
  def v2(a, b, *rest): pass
  def v3(a, (b, c), *rest): return a, b, c, rest
! 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