MCPcopy Create free account
hub / github.com/ipython/ipython / test_changing_py_file

Method test_changing_py_file

IPython/core/tests/test_ultratb.py:229–244  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

227 del ip.user_ns['foo']
228
229 def test_changing_py_file(self):
230 with TemporaryDirectory() as td:
231 fname = os.path.join(td, "foo.py")
232 with open(fname, 'w') as f:
233 f.write(se_file_1)
234
235 with tt.AssertPrints(["7/", "SyntaxError"]):
236 ip.magic("run " + fname)
237
238 # Modify the file
239 with open(fname, 'w') as f:
240 f.write(se_file_2)
241
242 # The SyntaxError should point to the correct line
243 with tt.AssertPrints(["7/", "SyntaxError"]):
244 ip.magic("run " + fname)
245
246 def test_non_syntaxerror(self):
247 # SyntaxTB may be called with an error other than a SyntaxError

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45
magicMethod · 0.45

Tested by

no test coverage detected