Show More
@@ -594,6 +594,21 b' def test_file():' | |||||
594 | nt.assert_in('line1\n', s) |
|
594 | nt.assert_in('line1\n', s) | |
595 | nt.assert_in('line2', s) |
|
595 | nt.assert_in('line2', s) | |
596 |
|
596 | |||
|
597 | def test_file_var_expand(): | |||
|
598 | """%%file $filename""" | |||
|
599 | ip = get_ipython() | |||
|
600 | with TemporaryDirectory() as td: | |||
|
601 | fname = os.path.join(td, 'file1') | |||
|
602 | ip.user_ns['filename'] = fname | |||
|
603 | ip.run_cell_magic("file", '$filename', u'\n'.join([ | |||
|
604 | 'line1', | |||
|
605 | 'line2', | |||
|
606 | ])) | |||
|
607 | with open(fname) as f: | |||
|
608 | s = f.read() | |||
|
609 | nt.assert_in('line1\n', s) | |||
|
610 | nt.assert_in('line2', s) | |||
|
611 | ||||
597 | def test_file_unicode(): |
|
612 | def test_file_unicode(): | |
598 | """%%file with unicode cell""" |
|
613 | """%%file with unicode cell""" | |
599 | ip = get_ipython() |
|
614 | ip = get_ipython() |
General Comments 0
You need to be logged in to leave comments.
Login now