Show More
@@ -2111,7 +2111,7 class InteractiveShell(SingletonConfigurable): | |||
|
2111 | 2111 | stack_depth = 2 |
|
2112 | 2112 | magic_arg_s = self.var_expand(line, stack_depth) |
|
2113 | 2113 | with self.builtin_trap: |
|
2114 |
result = fn( |
|
|
2114 | result = fn(magic_arg_s, cell) | |
|
2115 | 2115 | return result |
|
2116 | 2116 | |
|
2117 | 2117 | def find_line_magic(self, magic_name): |
@@ -594,6 +594,21 def test_file(): | |||
|
594 | 594 | nt.assert_in('line1\n', s) |
|
595 | 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 | 612 | def test_file_unicode(): |
|
598 | 613 | """%%file with unicode cell""" |
|
599 | 614 | ip = get_ipython() |
General Comments 0
You need to be logged in to leave comments.
Login now