diff --git a/IPython/core/tests/test_ultratb.py b/IPython/core/tests/test_ultratb.py index 25815c9..2d0a493 100644 --- a/IPython/core/tests/test_ultratb.py +++ b/IPython/core/tests/test_ultratb.py @@ -3,8 +3,10 @@ """ import io import os.path +from textwrap import dedent import unittest + from IPython.testing import tools as tt from IPython.testing.decorators import onlyif_unicode_paths from IPython.utils.syspathcontext import prepended_to_syspath @@ -89,6 +91,29 @@ class NonAsciiTest(unittest.TestCase): with tt.AssertPrints(u'дбИЖ', suppress=False): ip.run_cell('fail()') + +class NestedGenExprTestCase(unittest.TestCase): + """ + Regression test for the following issues: + https://github.com/ipython/ipython/issues/8293 + https://github.com/ipython/ipython/issues/8205 + """ + def test_nested_genexpr(self): + code = dedent( + """\ + class SpecificException(Exception): + pass + + def foo(x): + raise SpecificException("Success!") + + sum(sum(foo(x) for _ in [0]) for x in [0]) + """ + ) + with tt.AssertPrints('SpecificException: Success!', suppress=False): + ip.run_cell(code) + + indentationerror_file = """if True: zoon() """