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
Test with and without a space after !
  • Loading branch information
godlygeek committed May 4, 2025
commit c259bef79c6a6eae676b65510bfe50e8a37829f4
15 changes: 7 additions & 8 deletions Lib/test/test_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def completedefault(self, text, line, begidx, endidx):
return ["hello"]

def default(self, line):
if line == "! hello":
if line.replace(" ", "") == "!hello":
print('tab completion success')
else:
print('tab completion failure')
Expand All @@ -306,13 +306,12 @@ def default(self, line):
simplecmd().cmdloop()
""")

# '! h' and complete 'ello' to '! hello'
input = b"! h\t\n"

output = run_pty(script, input)

self.assertIn(b'ello', output)
self.assertIn(b'tab completion success', output)
# '! h' or '!h' and complete 'ello' to 'hello'
for input in [b"! h\t\n", b"!h\t\n"]:
with self.subTest(input=input):
output = run_pty(script, input)
self.assertIn(b'hello', output)
self.assertIn(b'tab completion success', output)

def load_tests(loader, tests, pattern):
tests.addTest(doctest.DocTestSuite())
Expand Down
Loading