%%writefile $filename
()
| 890 | nt.assert_in('line2', s) |
| 891 | |
| 892 | def test_file_var_expand(): |
| 893 | """%%writefile $filename""" |
| 894 | ip = get_ipython() |
| 895 | with TemporaryDirectory() as td: |
| 896 | fname = os.path.join(td, 'file1') |
| 897 | ip.user_ns['filename'] = fname |
| 898 | ip.run_cell_magic("writefile", '$filename', u'\n'.join([ |
| 899 | 'line1', |
| 900 | 'line2', |
| 901 | ])) |
| 902 | with open(fname) as f: |
| 903 | s = f.read() |
| 904 | nt.assert_in('line1\n', s) |
| 905 | nt.assert_in('line2', s) |
| 906 | |
| 907 | def test_file_unicode(): |
| 908 | """%%writefile with unicode cell""" |
nothing calls this directly
no test coverage detected