Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test for single line bracketed paste
  • Loading branch information
lysnikolaou committed May 7, 2024
commit 7331e9b688849cff6f87da4a7da8919a75e5212c
19 changes: 17 additions & 2 deletions Lib/test/test_pyrepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,6 @@ def test_bracketed_paste(self):
' else:\n'
' pass\n'
)
# fmt: on

output_code = (
'def a():\n'
Expand All @@ -842,8 +841,8 @@ def test_bracketed_paste(self):
'\n'
' else:\n'
' pass\n'
'\n'
)
# fmt: on

paste_start = "\x1b[200~"
paste_end = "\x1b[201~"
Expand All @@ -858,6 +857,22 @@ def test_bracketed_paste(self):
output = multiline_input(reader)
self.assertEqual(output, output_code)

def test_bracketed_paste_single_line(self):
input_code = "oneline"

paste_start = "\x1b[200~"
paste_end = "\x1b[201~"

events = itertools.chain(
code_to_events(paste_start),
code_to_events(input_code),
code_to_events(paste_end),
code_to_events("\n"),
)
reader = self.prepare_reader(events)
output = multiline_input(reader)
self.assertEqual(output, input_code)


class TestReader(TestCase):
def assert_screen_equals(self, reader, expected):
Expand Down