Show More
@@ -530,6 +530,25 b' def test_time_local_ns():' | |||||
530 | del ip.user_ns["myvar"] |
|
530 | del ip.user_ns["myvar"] | |
531 |
|
531 | |||
532 |
|
532 | |||
|
533 | # Test %%capture magic. Added to test issue #13926 | |||
|
534 | def test_capture(): | |||
|
535 | ip = get_ipython() | |||
|
536 | ||||
|
537 | # Test %%capture nominal case | |||
|
538 | ip.run_cell("%%capture abc\n1+2") | |||
|
539 | with tt.AssertPrints("True", suppress=False): | |||
|
540 | ip.run_cell("'abc' in locals()") | |||
|
541 | with tt.AssertPrints("True", suppress=False): | |||
|
542 | ip.run_cell("'outputs' in dir(abc)") | |||
|
543 | with tt.AssertPrints("3", suppress=False): | |||
|
544 | ip.run_cell("abc.outputs[0]") | |||
|
545 | ||||
|
546 | # Test %%capture with ';' at end of expression | |||
|
547 | ip.run_cell("%%capture abc\n7+8;") | |||
|
548 | with tt.AssertPrints("False", suppress=False): | |||
|
549 | ip.run_cell("'abc' in locals()") | |||
|
550 | ||||
|
551 | ||||
533 | def test_doctest_mode(): |
|
552 | def test_doctest_mode(): | |
534 | "Toggle doctest_mode twice, it should be a no-op and run without error" |
|
553 | "Toggle doctest_mode twice, it should be a no-op and run without error" | |
535 | _ip.run_line_magic("doctest_mode", "") |
|
554 | _ip.run_line_magic("doctest_mode", "") |
General Comments 0
You need to be logged in to leave comments.
Login now