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

Method test_paste_echo

tests/test_magic_terminal.py:182–197  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

180 self.assertEqual(ip.user_ns["zz"], 3.5)
181
182 def test_paste_echo(self):
183 "Also test self.paste echoing, by temporarily faking the writer"
184 w = StringIO()
185 old_write = sys.stdout.write
186 sys.stdout.write = w.write
187 code = """
188 a = 100
189 b = 200"""
190 try:
191 self.paste(code, "")
192 out = w.getvalue()
193 finally:
194 sys.stdout.write = old_write
195 self.assertEqual(ip.user_ns["a"], 100)
196 self.assertEqual(ip.user_ns["b"], 200)
197 assert out == code + "\n## -- End pasted text --\n"
198
199 def test_paste_leading_commas(self):
200 "Test multiline strings with leading commas"

Callers

nothing calls this directly

Calls 1

pasteMethod · 0.95

Tested by

no test coverage detected