Test that directories include an ending slash and files do not.
(cmd2_app, request)
| 459 | |
| 460 | |
| 461 | def test_path_completion_files_and_directories(cmd2_app, request) -> None: |
| 462 | """Test that directories include an ending slash and files do not.""" |
| 463 | test_dir = os.path.dirname(request.module.__file__) |
| 464 | |
| 465 | text = os.path.join(test_dir, "s") |
| 466 | line = f"shell cat {text}" |
| 467 | |
| 468 | endidx = len(line) |
| 469 | begidx = endidx - len(text) |
| 470 | |
| 471 | expected = [text + "cript.py", text + "cript.txt", text + "cripts" + os.path.sep] |
| 472 | completions = cmd2_app.path_complete(text, line, begidx, endidx) |
| 473 | assert completions.to_strings() == Completions.from_values(expected).to_strings() |
| 474 | |
| 475 | |
| 476 | def test_path_completion_nomatch(cmd2_app, request) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…