diff options
author | Guido van Rossum <guido@python.org> | 2007-05-07 22:24:25 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-07 22:24:25 +0000 |
commit | 805365ee39298f93e433e19ae0dd87c6f782145b (patch) | |
tree | ae8f8a3c315b49cfb2e7926d4b7e56f64c68b21c /Lib/test/test_genexps.py | |
parent | 598d98a7e8981e650e803e41e884ffc905b2311e (diff) | |
download | cpython-git-805365ee39298f93e433e19ae0dd87c6f782145b.tar.gz |
Merged revisions 55007-55179 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
........
r55077 | guido.van.rossum | 2007-05-02 11:54:37 -0700 (Wed, 02 May 2007) | 2 lines
Use the new print syntax, at least.
........
r55142 | fred.drake | 2007-05-04 21:27:30 -0700 (Fri, 04 May 2007) | 1 line
remove old cruftiness
........
r55143 | fred.drake | 2007-05-04 21:52:16 -0700 (Fri, 04 May 2007) | 1 line
make this work with the new Python
........
r55162 | neal.norwitz | 2007-05-06 22:29:18 -0700 (Sun, 06 May 2007) | 1 line
Get asdl code gen working with Python 2.3. Should continue to work with 3.0
........
r55164 | neal.norwitz | 2007-05-07 00:00:38 -0700 (Mon, 07 May 2007) | 1 line
Verify checkins to p3yk (sic) branch go to 3000 list.
........
r55166 | neal.norwitz | 2007-05-07 00:12:35 -0700 (Mon, 07 May 2007) | 1 line
Fix this test so it runs again by importing warnings_test properly.
........
r55167 | neal.norwitz | 2007-05-07 01:03:22 -0700 (Mon, 07 May 2007) | 8 lines
So long xrange. range() now supports values that are outside
-sys.maxint to sys.maxint. floats raise a TypeError.
This has been sitting for a long time. It probably has some problems and
needs cleanup. Objects/rangeobject.c now uses 4-space indents since
it is almost completely new.
........
r55171 | guido.van.rossum | 2007-05-07 10:21:26 -0700 (Mon, 07 May 2007) | 4 lines
Fix two tests that were previously depending on significant spaces
at the end of a line (and before that on Python 2.x print behavior
that has no exact equivalent in 3.0).
........
Diffstat (limited to 'Lib/test/test_genexps.py')
-rw-r--r-- | Lib/test/test_genexps.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py index cafca57234..7b5fdc451e 100644 --- a/Lib/test/test_genexps.py +++ b/Lib/test/test_genexps.py @@ -59,16 +59,16 @@ Does it stay stopped? Test running gen when defining function is out of scope >>> def f(n): - ... return (i*i for i in xrange(n)) + ... return (i*i for i in range(n)) >>> list(f(10)) [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] >>> def f(n): - ... return ((i,j) for i in xrange(3) for j in xrange(n)) + ... return ((i,j) for i in range(3) for j in range(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)) + ... return ((i,j) for i in range(3) for j in range(4) if j in range(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)] >>> list(f(2)) @@ -77,21 +77,21 @@ Test running gen when defining function is out of scope Verify that parenthesis are required in a statement >>> def f(n): - ... return i*i for i in xrange(n) + ... return i*i for i in range(n) Traceback (most recent call last): ... SyntaxError: invalid syntax Verify that parenthesis are required when used as a keyword argument value - >>> dict(a = i for i in xrange(10)) + >>> dict(a = i for i in range(10)) Traceback (most recent call last): ... SyntaxError: invalid syntax Verify that parenthesis are required when used as a keyword argument value - >>> dict(a = (i for i in xrange(10))) #doctest: +ELLIPSIS + >>> dict(a = (i for i in range(10))) #doctest: +ELLIPSIS {'a': <generator object at ...>} Verify early binding for the outermost for-expression @@ -128,7 +128,7 @@ Verify late binding for the innermost for-expression Verify re-use of tuples (a side benefit of using genexps over listcomps) - >>> tupleids = map(id, ((i,i) for i in xrange(10))) + >>> tupleids = map(id, ((i,i) for i in range(10))) >>> int(max(tupleids) - min(tupleids)) 0 @@ -149,7 +149,7 @@ Verify that syntax error's are raised for genexps used as lvalues Make a generator that acts like range() - >>> yrange = lambda n: (i for i in xrange(n)) + >>> yrange = lambda n: (i for i in range(n)) >>> list(yrange(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] @@ -181,14 +181,14 @@ Generators can call other generators: Verify that a gen exp cannot be resumed while it is actively running: - >>> g = (next(me) for i in xrange(10)) + >>> g = (next(me) for i in range(10)) >>> me = g >>> next(me) Traceback (most recent call last): File "<pyshell#30>", line 1, in -toplevel- next(me) File "<pyshell#28>", line 1, in <generator expression> - g = (next(me) for i in xrange(10)) + g = (next(me) for i in range(10)) ValueError: generator already executing Verify exception propagation @@ -211,7 +211,7 @@ Verify exception propagation Make sure that None is a valid return value - >>> list(None for i in xrange(10)) + >>> list(None for i in range(10)) [None, None, None, None, None, None, None, None, None, None] Check that generator attributes are present @@ -270,7 +270,7 @@ def test_main(verbose=None): if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 - for i in xrange(len(counts)): + for i in range(len(counts)): test_support.run_doctest(test_genexps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() |