Skip to content

Commit 1849a4c

Browse files
iamsharduldmiss-islington
authored andcommitted
pythongh-150922: Fix test_cmd libedit assertion in test_bang_completion_without_do_shell (pythonGH-156623)
GNU readline retypes the full completed word after tab completion, but libedit redraws only the untyped suffix following a cursor-forward escape sequence. Assert on the common suffix ('ello') instead of the literal 'hello' bytes so the test passes on both backends. (cherry picked from commit 0b4c7da5c401154af7b7cb89a6467365cadc2653) Co-authored-by: Shardul Deshpande <iamsharduld@users.noreply.github.com>
1 parent 96964c8 commit 1849a4c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/test/test_cmd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ def default(self, line):
316316
for input in [b"! h\t\n", b"!h\t\n"]:
317317
with self.subTest(input=input):
318318
output = run_pty(script, input)
319-
self.assertIn(b'hello', output)
319+
# libedit redraws only the untyped suffix after a
320+
# cursor-forward escape, unlike GNU readline which retypes
321+
# the whole completed word, so check the common suffix.
322+
self.assertIn(b'ello', output)
320323
self.assertIn(b'tab completion success', output)
321324

322325
def load_tests(loader, tests, pattern):

0 commit comments

Comments
 (0)