(self)
| 575 | self.assertEqual(result, []) |
| 576 | |
| 577 | async def test_async_push(self): |
| 578 | exc_raised = ZeroDivisionError |
| 579 | async def _expect_exc(exc_type, exc, exc_tb): |
| 580 | self.assertIs(exc_type, exc_raised) |
| 581 | async def _suppress_exc(*exc_details): |
| 582 | return True |
| 583 | async def _expect_ok(exc_type, exc, exc_tb): |
| 584 | self.assertIsNone(exc_type) |
| 585 | self.assertIsNone(exc) |
| 586 | self.assertIsNone(exc_tb) |
| 587 | class ExitCM(object): |
| 588 | def __init__(self, check_exc): |
| 589 | self.check_exc = check_exc |
| 590 | async def __aenter__(self): |
| 591 | self.fail("Should not be called!") |
| 592 | async def __aexit__(self, *exc_details): |
| 593 | await self.check_exc(*exc_details) |
| 594 | |
| 595 | async with self.exit_stack() as stack: |
| 596 | stack.push_async_exit(_expect_ok) |
| 597 | self.assertIs(stack._exit_callbacks[-1][1], _expect_ok) |
| 598 | cm = ExitCM(_expect_ok) |
| 599 | stack.push_async_exit(cm) |
| 600 | self.assertIs(stack._exit_callbacks[-1][1].__self__, cm) |
| 601 | stack.push_async_exit(_suppress_exc) |
| 602 | self.assertIs(stack._exit_callbacks[-1][1], _suppress_exc) |
| 603 | cm = ExitCM(_expect_exc) |
| 604 | stack.push_async_exit(cm) |
| 605 | self.assertIs(stack._exit_callbacks[-1][1].__self__, cm) |
| 606 | stack.push_async_exit(_expect_exc) |
| 607 | self.assertIs(stack._exit_callbacks[-1][1], _expect_exc) |
| 608 | stack.push_async_exit(_expect_exc) |
| 609 | self.assertIs(stack._exit_callbacks[-1][1], _expect_exc) |
| 610 | 1/0 |
| 611 | |
| 612 | async def test_enter_async_context(self): |
| 613 | class TestCM(object): |
nothing calls this directly
no test coverage detected