MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_add_subcommand

Method test_add_subcommand

tests/commands/test_base.py:243–260  ·  view source on GitHub ↗

Test adding subcommands.

(self)

Source from the content-addressed store, hash-verified

241 assert group.subcommands == {}
242
243 def test_add_subcommand(self):
244 """Test adding subcommands."""
245 group = DummyCommandGroup()
246
247 cmd1 = DummyCommand(name="sub1", description="Subcommand 1")
248 cmd2 = DummyCommand(name="sub2", description="Subcommand 2")
249
250 # Add subcommand with aliases
251 cmd1.aliases = ["s1", "alias1"]
252
253 group.add_subcommand(cmd1)
254 group.add_subcommand(cmd2)
255
256 assert "sub1" in group.subcommands
257 assert "sub2" in group.subcommands
258 assert "s1" in group.subcommands
259 assert "alias1" in group.subcommands
260 assert group.subcommands["s1"] is cmd1
261
262 @pytest.mark.asyncio
263 async def test_group_execute_no_subcommand(self):

Callers

nothing calls this directly

Calls 3

add_subcommandMethod · 0.80
DummyCommandGroupClass · 0.70
DummyCommandClass · 0.70

Tested by

no test coverage detected