summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-08-15 04:41:19 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-08-15 04:41:19 (GMT)
commite5614630fb1f73dd314945f6ccc871abb33e457e (patch)
tree8a77b9efe9de0ad41f8b2df2b59bf68b2c28a297 /Lib
parente578a63827b3b01e331a0751b62b737e008ca9e7 (diff)
downloadcpython-e5614630fb1f73dd314945f6ccc871abb33e457e.zip
cpython-e5614630fb1f73dd314945f6ccc871abb33e457e.tar.gz
cpython-e5614630fb1f73dd314945f6ccc871abb33e457e.tar.bz2
Move one of the tests into the "PEP 255" section, to reflect a change in
the PEP.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_generators.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 2476a27..41629d3 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -137,6 +137,21 @@ Generators can call other generators:
pep_tests = """
+Specification: Yield
+
+ Restriction: A generator cannot be resumed while it is actively
+ running:
+
+ >>> def g():
+ ... i = me.next()
+ ... yield i
+ >>> me = g()
+ >>> me.next()
+ Traceback (most recent call last):
+ ...
+ File "<string>", line 2, in g
+ ValueError: generator already executing
+
Specification: Return
Note that return isn't always equivalent to raising StopIteration: the
@@ -310,18 +325,6 @@ in try/except, not like a return.
>>> list(g())
[1, 2, 3]
-A generator can't be resumed while it's already running.
-
->>> def g():
-... i = me.next()
-... yield i
->>> me = g()
->>> me.next()
-Traceback (most recent call last):
- ...
- File "<string>", line 2, in g
-ValueError: generator already executing
-
Next one was posted to c.l.py.
>>> def gcomb(x, k):