MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / test_delimiter_completion_partial

Function test_delimiter_completion_partial

tests/test_completion.py:639–655  ·  view source on GitHub ↗

Test that a delimiter is added when an item has not been fully completed

(cmd2_app)

Source from the content-addressed store, hash-verified

637
638
639def test_delimiter_completion_partial(cmd2_app) -> None:
640 """Test that a delimiter is added when an item has not been fully completed"""
641 text = "/home/"
642 line = f"command {text}"
643 endidx = len(line)
644 begidx = endidx - len(text)
645
646 # All matches end with the delimiter
647 expected_items = [
648 CompletionItem("/home/other user/", display="other user/"),
649 CompletionItem("/home/user/", display="user/"),
650 ]
651 expected_completions = Completions(expected_items)
652 completions = cmd2_app.delimiter_complete(text, line, begidx, endidx, delimited_strs, "/")
653
654 assert completions.to_strings() == expected_completions.to_strings()
655 assert [item.display for item in completions] == [item.display for item in expected_completions]
656
657
658def test_delimiter_completion_full(cmd2_app) -> None:

Callers

nothing calls this directly

Calls 4

CompletionItemClass · 0.90
CompletionsClass · 0.90
delimiter_completeMethod · 0.80
to_stringsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…