Skip to content

Commit c259bef

Browse files
committed
Test with and without a space after !
1 parent 1c6248e commit c259bef

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Lib/test/test_cmd.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def completedefault(self, text, line, begidx, endidx):
297297
return ["hello"]
298298
299299
def default(self, line):
300-
if line == "! hello":
300+
if line.replace(" ", "") == "!hello":
301301
print('tab completion success')
302302
else:
303303
print('tab completion failure')
@@ -306,13 +306,12 @@ def default(self, line):
306306
simplecmd().cmdloop()
307307
""")
308308

309-
# '! h' and complete 'ello' to '! hello'
310-
input = b"! h\t\n"
311-
312-
output = run_pty(script, input)
313-
314-
self.assertIn(b'ello', output)
315-
self.assertIn(b'tab completion success', output)
309+
# '! h' or '!h' and complete 'ello' to 'hello'
310+
for input in [b"! h\t\n", b"!h\t\n"]:
311+
with self.subTest(input=input):
312+
output = run_pty(script, input)
313+
self.assertIn(b'hello', output)
314+
self.assertIn(b'tab completion success', output)
316315

317316
def load_tests(loader, tests, pattern):
318317
tests.addTest(doctest.DocTestSuite())

0 commit comments

Comments
 (0)