[Python-checkins] python/dist/src/Lib/test test_genexps.py,1.3,1.4
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Mon Aug 16 03:35:30 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1851
Modified Files:
test_genexps.py
Log Message:
* Uncomment the SyntaxError doctest after Tim demonstrated how.
* Remove unnecessary sys.PS2 prompt lines.
Index: test_genexps.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_genexps.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_genexps.py 8 Jul 2004 04:22:19 -0000 1.3
--- test_genexps.py 16 Aug 2004 01:35:28 -0000 1.4
***************
*** 61,65 ****
>>> def f(n):
... return (i*i for i in xrange(n))
- ...
>>> list(f(10))
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
--- 61,64 ----
***************
*** 67,76 ****
>>> def f(n):
... return ((i,j) for i in xrange(3) for j in xrange(n))
- ...
>>> list(f(4))
[(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)]
>>> def f(n):
... return ((i,j) for i in xrange(3) for j in xrange(4) if j in xrange(n))
- ...
>>> list(f(4))
[(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)]
--- 66,73 ----
***************
*** 78,86 ****
[(0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1)]
! #Verify that parenthesis are required in a statement
! #>>> def f(n):
! #... return i*i for i in xrange(n)
! #...
! #SyntaxError: invalid syntax
Verify early binding for the outermost for-expression
--- 75,84 ----
[(0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1)]
! Verify that parenthesis are required in a statement
! >>> def f(n):
! ... return i*i for i in xrange(n)
! Traceback (most recent call last):
! ...
! SyntaxError: invalid syntax
Verify early binding for the outermost for-expression
***************
*** 138,147 ****
... print "creator", r.next()
... return r
- ...
>>> def caller():
... r = creator()
... for i in r:
... print "caller", i
- ...
>>> caller()
creator 0
--- 136,143 ----
***************
*** 156,160 ****
... for i in yrange(n):
... yield i
- ...
>>> list(zrange(5))
[0, 1, 2, 3, 4]
--- 152,155 ----
More information about the Python-checkins
mailing list