##// END OF EJS Templates
Add failing test for suppressing exception chaining
Thomas Kluyver -
Show More
@@ -173,6 +173,13 b' except Exception as e:'
173 173 raise KeyError('uh')
174 174 """
175 175
176 SUPPRESS_CHAINING_CODE = """
177 try:
178 1/0
179 except Exception:
180 raise ValueError("Yikes") from None
181 """
182
176 183 def test_direct_cause_error(self):
177 184 if PY3:
178 185 with tt.AssertPrints(["KeyError", "NameError", "direct cause"]):
@@ -182,3 +189,9 b' except Exception as e:'
182 189 if PY3:
183 190 with tt.AssertPrints(["KeyError", "NameError", "During handling"]):
184 191 ip.run_cell(self.EXCEPTION_DURING_HANDLING_CODE)
192
193 def test_suppress_exception_chaining(self):
194 if PY3:
195 with tt.AssertNotPrints("ZeroDivisionError"), \
196 tt.AssertPrints("ValueError", suppress=False):
197 ip.run_cell(self.SUPPRESS_CHAINING_CODE)
General Comments 0
You need to be logged in to leave comments. Login now