Show More
@@ -9,6 +9,7 b' import os' | |||||
9 | import re |
|
9 | import re | |
10 | import sys |
|
10 | import sys | |
11 | import warnings |
|
11 | import warnings | |
|
12 | from textwrap import dedent | |||
12 | from unittest import TestCase |
|
13 | from unittest import TestCase | |
13 | from importlib import invalidate_caches |
|
14 | from importlib import invalidate_caches | |
14 | from io import StringIO |
|
15 | from io import StringIO | |
@@ -419,6 +420,19 b' def test_time3():' | |||||
419 | "run = 0\n" |
|
420 | "run = 0\n" | |
420 | "run += 1") |
|
421 | "run += 1") | |
421 |
|
422 | |||
|
423 | def test_multiline_time(): | |||
|
424 | """Make sure last statement from time return a value.""" | |||
|
425 | ip = get_ipython() | |||
|
426 | ip.user_ns.pop('run', None) | |||
|
427 | ||||
|
428 | ip.run_cell(dedent("""\ | |||
|
429 | %%time | |||
|
430 | a = "ho" | |||
|
431 | b = "hey" | |||
|
432 | a+b | |||
|
433 | """)) | |||
|
434 | nt.assert_equal(ip.user_ns_hidden['_'], 'hohey') | |||
|
435 | ||||
422 | def test_time_local_ns(): |
|
436 | def test_time_local_ns(): | |
423 | """ |
|
437 | """ | |
424 | Test that local_ns is actually global_ns when running a cell magic |
|
438 | Test that local_ns is actually global_ns when running a cell magic |
General Comments 0
You need to be logged in to leave comments.
Login now