def cmd_help(
        self,
        args: str,
        help_msg: str | None = None,
        topic: str | None = None,
        ret: int = ERR,
    ) -> None:
        """Run a command line, and check that it prints the right help.

        Only the last function call in the mock is checked, which should be the
        help message that we want to see.

        """
        mk, status = self.mock_command_line(args)
        assert status == ret, f"Wrong status: got {status}, wanted {ret}"
        if help_msg:
            assert mk.mock_calls[-1] == ('show_help', (help_msg,), {})
        else:
            assert mk.mock_calls[-1] == ('show_help', (), {'topic': topic})
Run a command line, and check that it prints the right help.

        Only the last function call in the mock is checked, which should be the
        help message that we want to see.

        
tests/test_cmdline.py