diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-01-31 00:01:54 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-01-31 00:01:54 (GMT) |
commit | 95728982825e1c7247d40e8cfcae48b46377baa6 (patch) | |
tree | 9119d9fd73c18e06a7e5c7a9cac54acdb71af1c8 /Lib/test | |
parent | 91445fbeb05f77551a8f83c5188362093916b0e1 (diff) | |
download | cpython-95728982825e1c7247d40e8cfcae48b46377baa6.zip cpython-95728982825e1c7247d40e8cfcae48b46377baa6.tar.gz cpython-95728982825e1c7247d40e8cfcae48b46377baa6.tar.bz2 |
asyncio: Future.set_exception(exc) should instantiate exc if it is a class.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_asyncio/test_futures.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index d3a7412..8a6976b 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -79,6 +79,11 @@ class FutureTests(unittest.TestCase): self.assertRaises(asyncio.InvalidStateError, f.set_exception, None) self.assertFalse(f.cancel()) + def test_exception_class(self): + f = asyncio.Future(loop=self.loop) + f.set_exception(RuntimeError) + self.assertIsInstance(f.exception(), RuntimeError) + def test_yield_from_twice(self): f = asyncio.Future(loop=self.loop) |