##// END OF EJS Templates
Merge pull request #10709 from Carreau/backport-pr-10637...
Matthias Bussonnier -
r23811:2f153812 merge
parent child Browse files
Show More
@@ -1013,6 +1013,13 b' python-profiler package from non-free.""")'
1013 ast_setup = self.shell.transform_ast(ast_setup)
1013 ast_setup = self.shell.transform_ast(ast_setup)
1014 ast_stmt = self.shell.transform_ast(ast_stmt)
1014 ast_stmt = self.shell.transform_ast(ast_stmt)
1015
1015
1016 # Check that these compile to valid Python code *outside* the timer func
1017 # Invalid code may become valid when put inside the function & loop,
1018 # which messes up error messages.
1019 # https://github.com/ipython/ipython/issues/10636
1020 self.shell.compile(ast_setup, "<magic-timeit-setup>", "exec")
1021 self.shell.compile(ast_stmt, "<magic-timeit-stmt>", "exec")
1022
1016 # This codestring is taken from timeit.template - we fill it in as an
1023 # This codestring is taken from timeit.template - we fill it in as an
1017 # AST, so that we can apply our AST transformations to the user code
1024 # AST, so that we can apply our AST transformations to the user code
1018 # without affecting the timing code.
1025 # without affecting the timing code.
@@ -583,6 +583,9 b' def test_timeit_futures():'
583 ip.compile.reset_compiler_flags()
583 ip.compile.reset_compiler_flags()
584 with tt.AssertNotPrints('0.25'):
584 with tt.AssertNotPrints('0.25'):
585 ip.run_line_magic('timeit', '-n1 -r1 print(1/4)')
585 ip.run_line_magic('timeit', '-n1 -r1 print(1/4)')
586 def test_timeit_invalid_return():
587 with nt.assert_raises_regexp(SyntaxError, "outside function"):
588 _ip.run_line_magic('timeit', 'return')
586
589
587 @dec.skipif(execution.profile is None)
590 @dec.skipif(execution.profile is None)
588 def test_prun_special_syntax():
591 def test_prun_special_syntax():
General Comments 0
You need to be logged in to leave comments. Login now