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

Function verify_help_text

tests/conftest.py:25–39  ·  view source on GitHub ↗

This function verifies that all expected commands are present in the help text. :param cmd2_app: instance of cmd2.Cmd :param help_output: output of help, either as a string or list of strings :param verbose_strings: optional list of verbose strings to search for

(cmd2_app: cmd2.Cmd, help_output: str | list[str], verbose_strings: list[str] | None = None)

Source from the content-addressed store, hash-verified

23
24
25def verify_help_text(cmd2_app: cmd2.Cmd, help_output: str | list[str], verbose_strings: list[str] | None = None) -> None:
26 """This function verifies that all expected commands are present in the help text.
27
28 :param cmd2_app: instance of cmd2.Cmd
29 :param help_output: output of help, either as a string or list of strings
30 :param verbose_strings: optional list of verbose strings to search for
31 """
32 help_text = help_output if isinstance(help_output, str) else "".join(help_output)
33 commands = cmd2_app.get_visible_commands()
34 for command in commands:
35 assert command in help_text
36
37 if verbose_strings:
38 for verbose_string in verbose_strings:
39 assert verbose_string in help_text
40
41
42# Output from the shortcuts command with default built-in shortcuts

Callers 10

test_base_helpFunction · 0.85
test_base_help_verboseFunction · 0.85
test_custom_help_menuFunction · 0.85
test_help_verboseFunction · 0.85
test_help_cat_baseFunction · 0.85
test_help_cat_verboseFunction · 0.85
test_multiple_aliasesFunction · 0.85
test_multiple_macrosFunction · 0.85

Calls 1

get_visible_commandsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…