From 4527b9ca0edb17e6c3d454f566cadbc78e91a7fc 2020-01-21 08:30:14 From: yangyang Date: 2020-01-21 08:30:14 Subject: [PATCH] add test --- diff --git a/IPython/core/tests/test_async_helpers.py b/IPython/core/tests/test_async_helpers.py index 2932189..86a516c 100644 --- a/IPython/core/tests/test_async_helpers.py +++ b/IPython/core/tests/test_async_helpers.py @@ -276,6 +276,10 @@ class AsyncTest(TestCase): """ ) + def test_memory_error(self): + with self.assertRaises(MemoryError): + iprc("(" * 200 + ")" * 200) + @skip_without('curio') def test_autoawait_curio(self): iprc("%autoawait curio") diff --git a/IPython/core/tests/test_ultratb.py b/IPython/core/tests/test_ultratb.py index c00b4d3..3ab0ce3 100644 --- a/IPython/core/tests/test_ultratb.py +++ b/IPython/core/tests/test_ultratb.py @@ -253,6 +253,13 @@ bar() ip.showsyntaxerror() +class MemoryErrorTest(unittest.TestCase): + def test_memoryerror(self): + memoryerror_code = "(" * 200 + ")" * 200 + with tt.AssertPrints("MemoryError"): + ip.run_cell(memoryerror_code) + + class Python3ChainedExceptionsTest(unittest.TestCase): DIRECT_CAUSE_ERROR_CODE = """ try: