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

Function _run_edit_test

IPython/core/tests/test_magic.py:1119–1138  ·  view source on GitHub ↗
(arg_s, exp_filename=None,
                        exp_lineno=-1,
                        exp_contents=None,
                        exp_is_temp=None)

Source from the content-addressed store, hash-verified

1117
1118
1119def _run_edit_test(arg_s, exp_filename=None,
1120 exp_lineno=-1,
1121 exp_contents=None,
1122 exp_is_temp=None):
1123 ip = get_ipython()
1124 M = code.CodeMagics(ip)
1125 last_call = ['','']
1126 opts,args = M.parse_options(arg_s,'prxn:')
1127 filename, lineno, is_temp = M._find_edit_target(ip, args, opts, last_call)
1128
1129 if exp_filename is not None:
1130 nt.assert_equal(exp_filename, filename)
1131 if exp_contents is not None:
1132 with io.open(filename, 'r', encoding='utf-8') as f:
1133 contents = f.read()
1134 nt.assert_equal(exp_contents, contents)
1135 if exp_lineno != -1:
1136 nt.assert_equal(exp_lineno, lineno)
1137 if exp_is_temp is not None:
1138 nt.assert_equal(exp_is_temp, is_temp)
1139
1140
1141def test_edit_interactive():

Callers 2

test_edit_interactiveFunction · 0.85
test_edit_cellFunction · 0.85

Calls 4

_find_edit_targetMethod · 0.95
get_ipythonFunction · 0.90
parse_optionsMethod · 0.80
readMethod · 0.80

Tested by

no test coverage detected