diff --git a/tests/structures/test_with.py b/tests/structures/test_with.py index f6a956c42c..0c14e354f8 100644 --- a/tests/structures/test_with.py +++ b/tests/structures/test_with.py @@ -1,5 +1,7 @@ from ..utils import TranspileTestCase +from unittest import expectedFailure + class WithLoopTests(TranspileTestCase): def test_with(self): @@ -37,6 +39,23 @@ def __exit__(self, exc_type, exc_value, traceback): raise KeyError('ola') """, exits_early=True) + @expectedFailure + def test_with_suppresses_exception(self): + self.assertCodeExecution(""" + class CtxMgr: + def __enter__(self): + print('entering CtxMgr') + def __exit__(self, exc_type, exc_value, traceback): + print('exiting CtxMgr') + print('exc_value', exc_value) + return True + + with CtxMgr(): + raise KeyError('ola') + + print('Done') + """) + def test_with_noexit(self): self.assertCodeExecution(""" class CtxMgrMissingExit: