예제 #1
0
    def test_coroutine_exception(self):
        async def coro():
            e = Exception()
            e.sentinel_value = 'Sentinel Exception'
            raise e

        t = Task(coro)
        t()
        self.assertTrue(t.done())
        self.assertEqual('Sentinel Exception', t.exception().sentinel_value)
        self.assertEqual(None, t.result())
예제 #2
0
    def test_exception(self):
        def func():
            e = Exception()
            e.sentinel_value = 'Sentinel Exception'
            raise e

        t = Task(func)
        t()
        self.assertTrue(t.done())
        self.assertEqual('Sentinel Exception', t.exception().sentinel_value)
        self.assertEqual(None, t.result())