##// END OF EJS Templates
Backport PR #12307: Fix some test on python 3.9 (nightly).
Matthias Bussonnier -
Show More
@@ -8,7 +8,7 b' import nose.tools as nt'
8 from textwrap import dedent, indent
8 from textwrap import dedent, indent
9 from unittest import TestCase
9 from unittest import TestCase
10 from IPython.testing.decorators import skip_without
10 from IPython.testing.decorators import skip_without
11
11 import sys
12
12
13 iprc = lambda x: ip.run_cell(dedent(x)).raise_error()
13 iprc = lambda x: ip.run_cell(dedent(x)).raise_error()
14 iprc_nr = lambda x: ip.run_cell(dedent(x))
14 iprc_nr = lambda x: ip.run_cell(dedent(x))
@@ -275,10 +275,13 b' class AsyncTest(TestCase):'
275 await sleep(0.1)
275 await sleep(0.1)
276 """
276 """
277 )
277 )
278
278
279 def test_memory_error(self):
279 if sys.version_info < (3,9):
280 with self.assertRaises(MemoryError):
280 # new pgen parser in 3.9 does not raise MemoryError on too many nested
281 iprc("(" * 200 + ")" * 200)
281 # parens anymore
282 def test_memory_error(self):
283 with self.assertRaises(MemoryError):
284 iprc("(" * 200 + ")" * 200)
282
285
283 @skip_without('curio')
286 @skip_without('curio')
284 def test_autoawait_curio(self):
287 def test_autoawait_curio(self):
@@ -421,6 +421,14 b' def test_render_signature_long():'
421 long_function.__name__,
421 long_function.__name__,
422 )
422 )
423 nt.assert_in(sig, [
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 # Python >=3.7
432 # Python >=3.7
425 '''\
433 '''\
426 long_function(
434 long_function(
@@ -252,12 +252,16 b' bar()'
252 with tt.AssertPrints('QWERTY'):
252 with tt.AssertPrints('QWERTY'):
253 ip.showsyntaxerror()
253 ip.showsyntaxerror()
254
254
255
255 import sys
256 class MemoryErrorTest(unittest.TestCase):
256 if sys.version_info < (3,9):
257 def test_memoryerror(self):
257 """
258 memoryerror_code = "(" * 200 + ")" * 200
258 New 3.9 Pgen Parser does not raise Memory error, except on failed malloc.
259 with tt.AssertPrints("MemoryError"):
259 """
260 ip.run_cell(memoryerror_code)
260 class MemoryErrorTest(unittest.TestCase):
261 def test_memoryerror(self):
262 memoryerror_code = "(" * 200 + ")" * 200
263 with tt.AssertPrints("MemoryError"):
264 ip.run_cell(memoryerror_code)
261
265
262
266
263 class Python3ChainedExceptionsTest(unittest.TestCase):
267 class Python3ChainedExceptionsTest(unittest.TestCase):
General Comments 0
You need to be logged in to leave comments. Login now