##// END OF EJS Templates
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(
@@ -247,12 +247,16 b' bar()'
247 with tt.AssertPrints('QWERTY'):
247 with tt.AssertPrints('QWERTY'):
248 ip.showsyntaxerror()
248 ip.showsyntaxerror()
249
249
250
250 import sys
251 class MemoryErrorTest(unittest.TestCase):
251 if sys.version_info < (3,9):
252 def test_memoryerror(self):
252 """
253 memoryerror_code = "(" * 200 + ")" * 200
253 New 3.9 Pgen Parser does not raise Memory error, except on failed malloc.
254 with tt.AssertPrints("MemoryError"):
254 """
255 ip.run_cell(memoryerror_code)
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 class Python3ChainedExceptionsTest(unittest.TestCase):
262 class Python3ChainedExceptionsTest(unittest.TestCase):
General Comments 0
You need to be logged in to leave comments. Login now