summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_listcomps.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_listcomps.py')
-rw-r--r--Lib/test/test_listcomps.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/Lib/test/test_listcomps.py b/Lib/test/test_listcomps.py
index bef4fff..6590777 100644
--- a/Lib/test/test_listcomps.py
+++ b/Lib/test/test_listcomps.py
@@ -43,20 +43,20 @@ Verify that syntax error's are raised for listcomps used as lvalues
Make a nested list comprehension that acts like range()
>>> def frange(n):
- ... return [i for i in xrange(n)]
+ ... return [i for i in range(n)]
>>> frange(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Same again, only as a lambda expression instead of a function definition
- >>> lrange = lambda n: [i for i in xrange(n)]
+ >>> lrange = lambda n: [i for i in range(n)]
>>> lrange(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Generators can call other generators:
>>> def grange(n):
- ... for x in [i for i in xrange(n)]:
+ ... for x in [i for i in range(n)]:
... yield x
>>> list(grange(5))
[0, 1, 2, 3, 4]
@@ -64,7 +64,7 @@ Generators can call other generators:
Make sure that None is a valid return value
- >>> [None for i in xrange(10)]
+ >>> [None for i in range(10)]
[None, None, None, None, None, None, None, None, None, None]
########### Tests for various scoping corner cases ############
@@ -138,7 +138,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()
@@ -191,20 +191,20 @@ Verify that syntax error's are raised for listcomps used as lvalues
Make a nested list comprehension that acts like range()
>>> def frange(n):
- ... return [i for i in xrange(n)]
+ ... return [i for i in range(n)]
>>> frange(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Same again, only as a lambda expression instead of a function definition
- >>> lrange = lambda n: [i for i in xrange(n)]
+ >>> lrange = lambda n: [i for i in range(n)]
>>> lrange(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Generators can call other generators:
>>> def grange(n):
- ... for x in [i for i in xrange(n)]:
+ ... for x in [i for i in range(n)]:
... yield x
>>> list(grange(5))
[0, 1, 2, 3, 4]
@@ -212,7 +212,7 @@ Generators can call other generators:
Make sure that None is a valid return value
- >>> [None for i in xrange(10)]
+ >>> [None for i in range(10)]
[None, None, None, None, None, None, None, None, None, None]
########### Tests for various scoping corner cases ############
@@ -286,7 +286,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()
@@ -339,20 +339,20 @@ Verify that syntax error's are raised for listcomps used as lvalues
Make a nested list comprehension that acts like range()
>>> def frange(n):
- ... return [i for i in xrange(n)]
+ ... return [i for i in range(n)]
>>> frange(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Same again, only as a lambda expression instead of a function definition
- >>> lrange = lambda n: [i for i in xrange(n)]
+ >>> lrange = lambda n: [i for i in range(n)]
>>> lrange(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Generators can call other generators:
>>> def grange(n):
- ... for x in [i for i in xrange(n)]:
+ ... for x in [i for i in range(n)]:
... yield x
>>> list(grange(5))
[0, 1, 2, 3, 4]
@@ -360,7 +360,7 @@ Generators can call other generators:
Make sure that None is a valid return value
- >>> [None for i in xrange(10)]
+ >>> [None for i in range(10)]
[None, None, None, None, None, None, None, None, None, None]
########### Tests for various scoping corner cases ############
@@ -434,7 +434,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()