%%writefile -a amends files
()
| 919 | nt.assert_in(u'liné2', s) |
| 920 | |
| 921 | def test_file_amend(): |
| 922 | """%%writefile -a amends files""" |
| 923 | ip = get_ipython() |
| 924 | with TemporaryDirectory() as td: |
| 925 | fname = os.path.join(td, 'file2') |
| 926 | ip.run_cell_magic("writefile", fname, u'\n'.join([ |
| 927 | 'line1', |
| 928 | 'line2', |
| 929 | ])) |
| 930 | ip.run_cell_magic("writefile", "-a %s" % fname, u'\n'.join([ |
| 931 | 'line3', |
| 932 | 'line4', |
| 933 | ])) |
| 934 | with open(fname) as f: |
| 935 | s = f.read() |
| 936 | nt.assert_in('line1\n', s) |
| 937 | nt.assert_in('line3\n', s) |
| 938 | |
| 939 | def test_file_spaces(): |
| 940 | """%%file with spaces in filename""" |
nothing calls this directly
no test coverage detected