diff options
author | Phillip J. Eby <pje@telecommunity.com> | 2006-03-25 00:05:50 (GMT) |
---|---|---|
committer | Phillip J. Eby <pje@telecommunity.com> | 2006-03-25 00:05:50 (GMT) |
commit | bee071221419795d707a15286e08424d141a6ca6 (patch) | |
tree | 1a507dcab84a78155055db907b418bff9932cc05 /Lib/test/test_generators.py | |
parent | 43b00da219d8490631f37cd4424fca30e1848404 (diff) | |
download | cpython-bee071221419795d707a15286e08424d141a6ca6.zip cpython-bee071221419795d707a15286e08424d141a6ca6.tar.gz cpython-bee071221419795d707a15286e08424d141a6ca6.tar.bz2 |
Support throw() of string exceptions.
Diffstat (limited to 'Lib/test/test_generators.py')
-rw-r--r-- | Lib/test/test_generators.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 4be1b4c..6b9b491 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -1545,6 +1545,9 @@ caught ValueError (1) >>> g.throw(ValueError, TypeError(1)) # mismatched type, rewrapped caught ValueError (1) +>>> g.throw(ValueError, ValueError(1), None) # explicit None traceback +caught ValueError (1) + >>> g.throw(ValueError(1), "foo") # bad args Traceback (most recent call last): ... @@ -1592,8 +1595,7 @@ ValueError: 7 >>> f().throw("abc") # throw on just-opened generator Traceback (most recent call last): ... -TypeError: exceptions must be classes, or instances, not str - +abc Now let's try closing a generator: |