summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/generator_send.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics/generator_send.py')
-rw-r--r--tests/basics/generator_send.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/basics/generator_send.py b/tests/basics/generator_send.py
index 4158478cac..c472c31ba9 100644
--- a/tests/basics/generator_send.py
+++ b/tests/basics/generator_send.py
@@ -13,3 +13,25 @@ except TypeError:
print(g.send(None))
print(g.send(100))
print(g.send(200))
+
+
+def f2():
+ print("entering")
+ for i in range(3):
+ print(i)
+ yield
+ print("returning 1")
+ print("returning 2")
+
+g = f2()
+g.send(None)
+g.send(1)
+g.send(1)
+try:
+ g.send(1)
+except StopIteration:
+ print("caught")
+try:
+ g.send(1)
+except StopIteration:
+ print("caught")