From 4bea912278d67a3c0a21079394f8396ec9cccbef Mon Sep 17 00:00:00 2001 From: James O'Hea Date: Wed, 23 Jul 2025 14:28:52 +0000 Subject: [PATCH 1/2] Ensure group is passed when binding commands --- src/fastcs/cs_methods.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fastcs/cs_methods.py b/src/fastcs/cs_methods.py index 5bcd9a267..8f7f216b5 100644 --- a/src/fastcs/cs_methods.py +++ b/src/fastcs/cs_methods.py @@ -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 From 1a89888ec52d14830159cc97fbc5a2a79353eab8 Mon Sep 17 00:00:00 2001 From: James O'Hea Date: Fri, 25 Jul 2025 09:16:22 +0000 Subject: [PATCH 2/2] Add test for ensuring group is passed when binding commands --- tests/test_cs_methods.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_cs_methods.py b/tests/test_cs_methods.py index 7b05bb924..cda1dd96b 100644 --- a/tests/test_cs_methods.py +++ b/tests/test_cs_methods.py @@ -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() @@ -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()