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

Class BadNestedSubcommands

tests/test_commandset.py:687–698  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685 manual_command_sets_app.unregister_command_set(base_cmds)
686
687 class BadNestedSubcommands(cmd2.CommandSet):
688 def __init__(self, dummy) -> None:
689 super().__init__()
690 self._dummy = dummy # prevents autoload
691
692 stir_pasta_vigor_parser = cmd2.Cmd2ArgumentParser()
693 stir_pasta_vigor_parser.add_argument("frequency")
694
695 # stir sauce doesn't exist anywhere, this should fail
696 @cmd2.as_subcommand_to("stir sauce", "vigorously", stir_pasta_vigor_parser)
697 def stir_pasta_vigorously(self, ns: argparse.Namespace) -> None:
698 self._cmd.poutput("stir the pasta vigorously")
699
700 with pytest.raises(CommandSetRegistrationError):
701 manual_command_sets_app.register_command_set(BadNestedSubcommands(1))

Callers 1

test_nested_subcommandsFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_nested_subcommandsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…