summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_b2.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-06-05 23:12:45 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-06-05 23:12:45 (GMT)
commitc4c453f5ae0a245aa0dd59431c323911c47f2735 (patch)
tree12218c6354e18f6992ed5e7b6f92cd1a5ef3436d /Lib/test/test_b2.py
parentf97b2d7dad06e48e3bc255f16329fda1dc966da4 (diff)
downloadcpython-c4c453f5ae0a245aa0dd59431c323911c47f2735.zip
cpython-c4c453f5ae0a245aa0dd59431c323911c47f2735.tar.gz
cpython-c4c453f5ae0a245aa0dd59431c323911c47f2735.tar.bz2
Skip Montanaro's patch, SF 559833, exposing xrange type in builtins.
Also, added more regression tests to cover the new type and test its conformity with range().
Diffstat (limited to 'Lib/test/test_b2.py')
-rw-r--r--Lib/test/test_b2.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_b2.py b/Lib/test/test_b2.py
index 459fd6b..a8bc22a 100644
--- a/Lib/test/test_b2.py
+++ b/Lib/test/test_b2.py
@@ -295,6 +295,11 @@ if tuple(xrange(10)) != tuple(range(10)): raise TestFailed, 'xrange(10)'
if tuple(xrange(5,10)) != tuple(range(5,10)): raise TestFailed, 'xrange(5,10)'
if tuple(xrange(0,10,2)) != tuple(range(0,10,2)):
raise TestFailed, 'xrange(0,10,2)'
+x = xrange(10); a = iter(x); b = iter(a) # test clearing of SF bug 564601
+if id(x) == id(a): raise TestFailed, "xrange doesn't have a separate iterator"
+if id(a) != id(b): raise TestFailed, "xrange iterator not behaving like range"
+if type(x) != xrange: raise TestFailed, "xrange type not exposed" # SF 559833
+if list(x) != list(x): raise TestFailed, "xrange should be restartable"
print 'zip'
a = (1, 2, 3)