From 28443fc1f92ac80014e024b216b889c2bd949934 Mon Sep 17 00:00:00 2001 From: Patience Shyu Date: Wed, 1 Aug 2018 13:55:29 +0200 Subject: [PATCH] add test for 886 --- tests/structures/test_with.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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: