summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_generators.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_generators.py')
-rw-r--r--Lib/test/test_generators.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index ee36413..2ffd2f8 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -1585,6 +1585,21 @@ Traceback (most recent call last):
...
TypeError: throw() third argument must be a traceback object
+>>> g.throw("abc")
+Traceback (most recent call last):
+ ...
+TypeError: exceptions must be classes or instances deriving from BaseException, not str
+
+>>> g.throw(0)
+Traceback (most recent call last):
+ ...
+TypeError: exceptions must be classes or instances deriving from BaseException, not int
+
+>>> g.throw(list)
+Traceback (most recent call last):
+ ...
+TypeError: exceptions must be classes or instances deriving from BaseException, not type
+
>>> def throw(g,exc):
... try:
... raise exc
@@ -1619,11 +1634,6 @@ Traceback (most recent call last):
...
ValueError: 7
->>> f().throw("abc") # throw on just-opened generator
-Traceback (most recent call last):
- ...
-abc
-
Now let's try closing a generator:
>>> def f():