diff -r 1756beed417c Lib/test/test_readline.py --- a/Lib/test/test_readline.py Sat Dec 17 09:19:11 2016 +0100 +++ b/Lib/test/test_readline.py Sun Dec 18 16:07:46 2016 +0100 @@ -171,16 +171,21 @@ if set_pre_input_hook: set_pre_input_hook(pre_input_hook) +x = [] def completer(text, state): + x.append('%s-%d' % (text, state)) if text == "t\xEB": if state == 0: print("text", ascii(text)) print("line", ascii(readline.get_line_buffer())) print("indexes", readline.get_begidx(), readline.get_endidx()) + x.append('GOT 1') return "t\xEBnt" if state == 1: + x.append('GOT 2') return "t\xEBxt" if text == "t\xEBx" and state == 0: + x.append('GOT 3') return "t\xEBxt" return None readline.set_completer(completer) @@ -192,6 +197,7 @@ print("result", ascii(input())) print("history", ascii(readline.get_history_item(1))) +print('completer', x) """ input = b"\x01" # Ctrl-A, expands to "|t\xEB[after]" @@ -200,6 +206,7 @@ input += b"x\t" # Complete "t\xEBx" -> "t\xEBxt" input += b"\r" output = run_pty(script, input) + print(output) self.assertIn(b"text 't\\xeb'\r\n", output) self.assertIn(b"line '[\\xefnserted]|t\\xeb[after]'\r\n", output) self.assertIn(b"indexes 11 13\r\n", output)