MCPcopy Index your code
hub / github.com/python/cpython / test_paste

Method test_paste

Lib/test/test_pyrepl/test_pyrepl.py:1711–1735  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1709 return reader
1710
1711 def test_paste(self):
1712 # fmt: off
1713 code = (
1714 "def a():\n"
1715 " for x in range(10):\n"
1716 " if x%2:\n"
1717 " print(x)\n"
1718 " else:\n"
1719 " pass\n"
1720 )
1721 # fmt: on
1722
1723 events = itertools.chain(
1724 [
1725 Event(evt="key", data="f3", raw=bytearray(b"\x1bOR")),
1726 ],
1727 code_to_events(code),
1728 [
1729 Event(evt="key", data="f3", raw=bytearray(b"\x1bOR")),
1730 ],
1731 code_to_events("\n"),
1732 )
1733 reader = self.prepare_reader(events)
1734 output = multiline_input(reader)
1735 self.assertEqual(output, code)
1736
1737 def test_paste_mid_newlines(self):
1738 # fmt: off

Callers

nothing calls this directly

Calls 6

prepare_readerMethod · 0.95
EventClass · 0.90
code_to_eventsFunction · 0.85
multiline_inputFunction · 0.85
chainMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected