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

Function test_dynamic_complete_style

tests/test_dynamic_complete_style.py:34–52  ·  view source on GitHub ↗
(app)

Source from the content-addressed store, hash-verified

32
33
34def test_dynamic_complete_style(app):
35 # Cmd.complete() interacts with app.active_session.
36 # Set it here since it's normally set when the prompt is created.
37 app.active_session: PromptSession[str] = PromptSession(
38 input=app.main_session.input,
39 output=app.main_session.output,
40 )
41
42 # Default max_column_completion_results is 7
43 assert app.max_column_completion_results == 7
44
45 # Complete 'foo' which has 10 items (> 7)
46 # text='item', state=0, line='foo item', begidx=4, endidx=8
47 app.complete("item", "foo item", 4, 8)
48 assert app.active_session.complete_style == CompleteStyle.MULTI_COLUMN
49
50 # Complete 'bar' which has 5 items (<= 7)
51 app.complete("item", "bar item", 4, 8)
52 assert app.active_session.complete_style == CompleteStyle.COLUMN
53
54
55def test_dynamic_complete_style_custom_limit(app):

Callers

nothing calls this directly

Calls 1

completeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…