Basic %%writefile
()
| 1268 | |
| 1269 | |
| 1270 | def test_file(): |
| 1271 | """Basic %%writefile""" |
| 1272 | ip = get_ipython() |
| 1273 | with TemporaryDirectory() as td: |
| 1274 | fname = os.path.join(td, "file1") |
| 1275 | ip.run_cell_magic( |
| 1276 | "writefile", |
| 1277 | fname, |
| 1278 | "\n".join( |
| 1279 | [ |
| 1280 | "line1", |
| 1281 | "line2", |
| 1282 | ] |
| 1283 | ), |
| 1284 | ) |
| 1285 | s = Path(fname).read_text(encoding="utf-8") |
| 1286 | assert "line1\n" in s |
| 1287 | assert "line2" in s |
| 1288 | |
| 1289 | |
| 1290 | @dec.skip_win32 |
nothing calls this directly
no test coverage detected
searching dependent graphs…