Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fastcs/cs_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _validate(self, fn: UnboundCommandCallback[Controller_T]) -> None:
raise FastCSException("Command method cannot have arguments")

def bind(self, controller: Controller_T) -> Command:
return Command(MethodType(self.fn, controller))
return Command(MethodType(self.fn, controller), group=self.group)

def __call__(self):
raise method_not_bound_error
Expand Down
4 changes: 3 additions & 1 deletion tests/test_cs_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async def do_nothing(self):
async def do_nothing_with_arg(self, arg):
pass

unbound_command = UnboundCommand(TestController.do_nothing)
unbound_command = UnboundCommand(TestController.do_nothing, group="Test")

with pytest.raises(NotImplementedError):
await unbound_command()
Expand All @@ -57,6 +57,8 @@ async def do_nothing_with_arg(self, arg):
Command(TestController().do_nothing_with_arg) # type: ignore

command = unbound_command.bind(TestController())
# Test that group is passed when binding commands
assert command.group == "Test"

await command()

Expand Down
Loading