##// END OF EJS Templates
Merge pull request #2168 from minrk/expandscript...
Fernando Perez -
r7917:b9f84f18 merge
parent child Browse files
Show More
@@ -2111,7 +2111,7 b' class InteractiveShell(SingletonConfigurable):'
2111 stack_depth = 2
2111 stack_depth = 2
2112 magic_arg_s = self.var_expand(line, stack_depth)
2112 magic_arg_s = self.var_expand(line, stack_depth)
2113 with self.builtin_trap:
2113 with self.builtin_trap:
2114 result = fn(line, cell)
2114 result = fn(magic_arg_s, cell)
2115 return result
2115 return result
2116
2116
2117 def find_line_magic(self, magic_name):
2117 def find_line_magic(self, magic_name):
@@ -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