(self)
| 398 | self.assertEqual(line_num, len(lines)) |
| 399 | |
| 400 | def test_complete_no_input(self): |
| 401 | script = textwrap.dedent(""" |
| 402 | import readline |
| 403 | from sqlite3.__main__ import main |
| 404 | |
| 405 | # Configure readline to ...: |
| 406 | # - hide control sequences surrounding each candidate |
| 407 | # - hide "Display all xxx possibilities? (y or n)" |
| 408 | # - hide "--More--" |
| 409 | # - show candidates one per line |
| 410 | readline.parse_and_bind("set colored-completion-prefix off") |
| 411 | readline.parse_and_bind("set colored-stats off") |
| 412 | readline.parse_and_bind("set completion-query-items 0") |
| 413 | readline.parse_and_bind("set page-completions off") |
| 414 | readline.parse_and_bind("set completion-display-width 0") |
| 415 | readline.parse_and_bind("set show-all-if-ambiguous off") |
| 416 | readline.parse_and_bind("set show-all-if-unmodified off") |
| 417 | |
| 418 | main() |
| 419 | """) |
| 420 | input_ = b"\t\t.quit\n" |
| 421 | output = run_pty(script, input_, env={**os.environ, "NO_COLOR": "1"}) |
| 422 | try: |
| 423 | lines = output.decode().splitlines() |
| 424 | indices = [ |
| 425 | i for i, line in enumerate(lines) |
| 426 | if line.startswith(self.PS1) |
| 427 | ] |
| 428 | self.assertEqual(len(indices), 2) |
| 429 | start, end = indices |
| 430 | candidates = [l.strip() for l in lines[start+1:end]] |
| 431 | self.assertEqual(candidates, sorted(candidates)) |
| 432 | except: |
| 433 | if verbose: |
| 434 | print(' PTY output: '.center(30, '-')) |
| 435 | print(output.decode(errors='replace')) |
| 436 | print(' end PTY output '.center(30, '-')) |
| 437 | raise |
| 438 | |
| 439 | |
| 440 |
nothing calls this directly
no test coverage detected