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)
| 23 | |
| 24 | |
| 25 | def 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 |
no test coverage detected
searching dependent graphs…