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

Method test_paste_echo

IPython/core/tests/test_magic_terminal.py:153–168  ·  view source on GitHub ↗

Also test self.paste echoing, by temporarily faking the writer

(self)

Source from the content-addressed store, hash-verified

151 nt.assert_equal(ip.user_ns['zz'], 3.5)
152
153 def test_paste_echo(self):
154 "Also test self.paste echoing, by temporarily faking the writer"
155 w = StringIO()
156 writer = ip.write
157 ip.write = w.write
158 code = """
159 a = 100
160 b = 200"""
161 try:
162 self.paste(code,'')
163 out = w.getvalue()
164 finally:
165 ip.write = writer
166 nt.assert_equal(ip.user_ns['a'], 100)
167 nt.assert_equal(ip.user_ns['b'], 200)
168 assert out == code+"\n## -- End pasted text --\n"
169
170 def test_paste_leading_commas(self):
171 "Test multiline strings with leading commas"

Callers

nothing calls this directly

Calls 1

pasteMethod · 0.95

Tested by

no test coverage detected