Show More
@@ -8,7 +8,7 b' import nose.tools as nt' | |||
|
8 | 8 | from textwrap import dedent, indent |
|
9 | 9 | from unittest import TestCase |
|
10 | 10 | from IPython.testing.decorators import skip_without |
|
11 | ||
|
11 | import sys | |
|
12 | 12 | |
|
13 | 13 | iprc = lambda x: ip.run_cell(dedent(x)).raise_error() |
|
14 | 14 | iprc_nr = lambda x: ip.run_cell(dedent(x)) |
@@ -275,10 +275,13 b' class AsyncTest(TestCase):' | |||
|
275 | 275 | await sleep(0.1) |
|
276 | 276 | """ |
|
277 | 277 | ) |
|
278 | ||
|
279 | def test_memory_error(self): | |
|
280 | with self.assertRaises(MemoryError): | |
|
281 | iprc("(" * 200 + ")" * 200) | |
|
278 | ||
|
279 | if sys.version_info < (3,9): | |
|
280 | # new pgen parser in 3.9 does not raise MemoryError on too many nested | |
|
281 | # parens anymore | |
|
282 | def test_memory_error(self): | |
|
283 | with self.assertRaises(MemoryError): | |
|
284 | iprc("(" * 200 + ")" * 200) | |
|
282 | 285 | |
|
283 | 286 | @skip_without('curio') |
|
284 | 287 | def test_autoawait_curio(self): |
@@ -421,6 +421,14 b' def test_render_signature_long():' | |||
|
421 | 421 | long_function.__name__, |
|
422 | 422 | ) |
|
423 | 423 | nt.assert_in(sig, [ |
|
424 | # Python >=3.9 | |
|
425 | '''\ | |
|
426 | long_function( | |
|
427 | a_really_long_parameter: int, | |
|
428 | and_another_long_one: bool = False, | |
|
429 | let_us_make_sure_this_is_looong: Optional[str] = None, | |
|
430 | ) -> bool\ | |
|
431 | ''', | |
|
424 | 432 | # Python >=3.7 |
|
425 | 433 | '''\ |
|
426 | 434 | long_function( |
@@ -247,12 +247,16 b' bar()' | |||
|
247 | 247 | with tt.AssertPrints('QWERTY'): |
|
248 | 248 | ip.showsyntaxerror() |
|
249 | 249 | |
|
250 | ||
|
251 | class MemoryErrorTest(unittest.TestCase): | |
|
252 | def test_memoryerror(self): | |
|
253 | memoryerror_code = "(" * 200 + ")" * 200 | |
|
254 | with tt.AssertPrints("MemoryError"): | |
|
255 | ip.run_cell(memoryerror_code) | |
|
250 | import sys | |
|
251 | if sys.version_info < (3,9): | |
|
252 | """ | |
|
253 | New 3.9 Pgen Parser does not raise Memory error, except on failed malloc. | |
|
254 | """ | |
|
255 | class MemoryErrorTest(unittest.TestCase): | |
|
256 | def test_memoryerror(self): | |
|
257 | memoryerror_code = "(" * 200 + ")" * 200 | |
|
258 | with tt.AssertPrints("MemoryError"): | |
|
259 | ip.run_cell(memoryerror_code) | |
|
256 | 260 | |
|
257 | 261 | |
|
258 | 262 | class Python3ChainedExceptionsTest(unittest.TestCase): |
General Comments 0
You need to be logged in to leave comments.
Login now