diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-11-14 08:15:44 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-11-14 08:15:44 (GMT) |
commit | 996fc1fcfc165a8d7f56b6d31933b594a5f48d73 (patch) | |
tree | e655847d7f22f0201fa306b524ac9377478e18e1 /Lib/test/test_asyncio | |
parent | f8cebad2901799ebfceb3228a7ba69a504e21f75 (diff) | |
download | cpython-996fc1fcfc165a8d7f56b6d31933b594a5f48d73.zip cpython-996fc1fcfc165a8d7f56b6d31933b594a5f48d73.tar.gz cpython-996fc1fcfc165a8d7f56b6d31933b594a5f48d73.tar.bz2 |
correctly emulate error semantics of gen.throw in FutureIter_throw
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_futures.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index c147608..89afdca 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -466,6 +466,15 @@ class BaseFutureTests: self.fail('StopIteration was expected') self.assertEqual(result, (1, 2)) + def test_future_iter_throw(self): + fut = self._new_future(loop=self.loop) + fi = iter(fut) + self.assertRaises(TypeError, fi.throw, + Exception, Exception("elephant"), 32) + self.assertRaises(TypeError, fi.throw, + Exception("elephant"), Exception("elephant")) + self.assertRaises(TypeError, fi.throw, list) + @unittest.skipUnless(hasattr(futures, '_CFuture'), 'requires the C _asyncio module') |