[Python-checkins] python/dist/src/Lib/test test_grammar.py, 1.40.8.1, 1.40.8.2

jhylton at users.sourceforge.net jhylton at users.sourceforge.net
Fri Apr 23 14:36:58 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7227/test

Modified Files:
      Tag: ast-branch
	test_grammar.py 
Log Message:
The new compiler generates sequential temp ids (0, 1, 2), not even (0, 2, 4).
Also, replace a bunch of verify() calls with vereq().


Index: test_grammar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v
retrieving revision 1.40.8.1
retrieving revision 1.40.8.2
diff -C2 -d -r1.40.8.1 -r1.40.8.2
*** test_grammar.py	28 Apr 2003 17:28:44 -0000	1.40.8.1
--- test_grammar.py	23 Apr 2004 18:36:55 -0000	1.40.8.2
***************
*** 9,13 ****
  # regrtest.py.
  
! from test.test_support import TestFailed, verify, check_syntax
  import sys
  
--- 9,13 ----
  # regrtest.py.
  
! from test.test_support import TestFailed, verify, vereq, check_syntax
  import sys
  
***************
*** 158,173 ****
  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'))
  if sys.platform.startswith('java'):
!     verify(f4.func_code.co_varnames ==
             ('two', '(compound, (argument, list))', '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
--- 158,174 ----
  def f4(two, (compound, (argument, list))): pass
  def f5((compound, first), two): pass
! vereq(f2.func_code.co_varnames, ('one_argument',))
! vereq(f3.func_code.co_varnames, ('two', 'arguments'))
  if sys.platform.startswith('java'):
!     vereq(f4.func_code.co_varnames,
             ('two', '(compound, (argument, list))', 'compound', 'argument',
                          'list',))
!     vereq(f5.func_code.co_varnames,
             ('(compound, first)', 'two', 'compound', 'first'))
  else:
!     vereq(f4.func_code.co_varnames,
!           ('two', '.1', 'compound', 'argument',  'list'))
!     vereq(f5.func_code.co_varnames,
!           ('.0', 'two', 'compound', 'first'))
  def a1(one_arg,): pass
  def a2(two, args,): pass
***************
*** 176,183 ****
  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
--- 177,186 ----
  def v2(a, b, *rest): pass
  def v3(a, (b, c), *rest): return a, b, c, rest
+ # ceval unpacks the formal arguments into the first argcount names;
+ # thus, the names nested inside tuples must appear after these names.
  if sys.platform.startswith('java'):
      verify(v3.func_code.co_varnames == ('a', '(b, c)', 'rest', 'b', 'c'))
  else:
!     vereq(v3.func_code.co_varnames, ('a', '.1', 'rest', 'b', 'c'))
  verify(v3(1, (2, 3), 4) == (1, 2, 3, (4,)))
  def d01(a=1): pass




More information about the Python-checkins mailing list