##// END OF EJS Templates
Backport PR #12453: Allow spaces when using debug magic
Matthias Bussonnier -
Show More
@@ -467,7 +467,13 b' python-profiler package from non-free.""")'
467 467
468 468 if not (args.breakpoint or args.statement or cell):
469 469 self._debug_post_mortem()
470 elif not (args.breakpoint or cell):
471 # If there is no breakpoints, the line is just code to execute
472 self._debug_exec(line, None)
470 473 else:
474 # Here we try to reconstruct the code from the output of
475 # parse_argstring. This might not work if the code has spaces
476 # For example this fails for `print("a b")`
471 477 code = "\n".join(args.statement)
472 478 if cell:
473 479 code += "\n" + cell
@@ -32,6 +32,7 b' from IPython.utils.io import capture_output'
32 32 from IPython.utils.tempdir import (TemporaryDirectory,
33 33 TemporaryWorkingDirectory)
34 34 from IPython.utils.process import find_cmd
35 from .test_debugger import PdbTestInput
35 36
36 37
37 38 @magic.magics_class
@@ -622,6 +623,18 b' def doctest_precision():'
622 623 Out[5]: '3.141593e+00'
623 624 """
624 625
626 def test_debug_magic():
627 """Test debugging a small code with %debug
628
629 In [1]: with PdbTestInput(['c']):
630 ...: %debug print("a b") #doctest: +ELLIPSIS
631 ...:
632 ...
633 ipdb> c
634 a b
635 In [2]:
636 """
637
625 638 def test_psearch():
626 639 with tt.AssertPrints("dict.fromkeys"):
627 640 _ip.run_cell("dict.fr*?")
General Comments 0
You need to be logged in to leave comments. Login now