[Python-checkins] CVS: python/dist/src/Lib/test test_parser.py,1.2,1.3

Fred L. Drake python-dev@python.org
Mon, 11 Dec 2000 14:12:12 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv25558/Lib/test

Modified Files:
	test_parser.py 
Log Message:

Added tests to avoid regression on bug #125375.

roundtrip():  Show the offending syntax tree when things break; this makes
              it a little easier to debug the module by adding test cases.

(Still need better tests for this module, but there's not enough time
 today.)


Index: test_parser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_parser.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_parser.py	2000/08/25 22:42:40	1.2
--- test_parser.py	2000/12/11 22:12:09	1.3
***************
*** 16,20 ****
      st1 = f(s)
      t = st1.totuple()
!     st2 = parser.sequence2ast(t)
  
  def roundtrip_fromfile(filename):
--- 16,25 ----
      st1 = f(s)
      t = st1.totuple()
!     try:
!         st2 = parser.sequence2ast(t)
!     except parser.ParserError:
!         print "Failing syntax tree:"
!         pprint.pprint(t)
!         raise
  
  def roundtrip_fromfile(filename):
***************
*** 47,50 ****
--- 52,67 ----
  test_expr("foo(a, b, c, **kw)")
  test_expr("foo + bar")
+ test_expr("lambda: 0")
+ test_expr("lambda x: 0")
+ test_expr("lambda *y: 0")
+ test_expr("lambda *y, **z: 0")
+ test_expr("lambda **z: 0")
+ test_expr("lambda x, y: 0")
+ test_expr("lambda foo=bar: 0")
+ test_expr("lambda foo=bar, spaz=nifty+spit: 0")
+ test_expr("lambda foo=bar, **z: 0")
+ test_expr("lambda foo=bar, blaz=blat+2, **z: 0")
+ test_expr("lambda foo=bar, blaz=blat+2, *y, **z: 0")
+ test_expr("lambda x, *y, **z: 0")
  
  print
***************
*** 72,75 ****
--- 89,94 ----
  test_suite("a >>= b")
  test_suite("a **= b")
+ test_suite("def f(): pass")
+ test_suite("def f(foo=bar): pass")
  
  #d = os.path.dirname(os.__file__)