(cmd2_app)
| 487 | |
| 488 | |
| 489 | def test_path_completion_no_text(cmd2_app) -> None: |
| 490 | # Run path complete with no search text which should show what's in cwd |
| 491 | text = "" |
| 492 | line = f"shell ls {text}" |
| 493 | endidx = len(line) |
| 494 | begidx = endidx - len(text) |
| 495 | completions_no_text = cmd2_app.path_complete(text, line, begidx, endidx) |
| 496 | |
| 497 | # Run path complete with path set to the CWD |
| 498 | text = os.getcwd() + os.path.sep |
| 499 | line = f"shell ls {text}" |
| 500 | endidx = len(line) |
| 501 | begidx = endidx - len(text) |
| 502 | completions_cwd = cmd2_app.path_complete(text, line, begidx, endidx) |
| 503 | |
| 504 | # To compare matches, strip off the CWD from the front of completions_cwd. |
| 505 | stripped_paths = [CompletionItem(value=item.text.replace(text, "", 1)) for item in completions_cwd] |
| 506 | completions_cwd = dataclasses.replace(completions_cwd, items=stripped_paths) |
| 507 | |
| 508 | # Verify that the first test gave results for entries in the cwd |
| 509 | assert completions_no_text == completions_cwd |
| 510 | assert completions_cwd |
| 511 | |
| 512 | |
| 513 | def test_path_completion_no_path(cmd2_app) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…