MCPcopy Index your code
hub / github.com/ipython/ipython / test_file

Function test_file

tests/test_magic.py:1270–1287  ·  view source on GitHub ↗

Basic %%writefile

()

Source from the content-addressed store, hash-verified

1268
1269
1270def 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

Callers

nothing calls this directly

Calls 2

get_ipythonFunction · 0.90
run_cell_magicMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…