2323from fastcs .transports .epics .gui import EpicsGUI
2424
2525
26- def test_get_pv (controller_api ):
27- gui = EpicsGUI (controller_api , "DEVICE" )
26+ def test_get_pv ():
27+ gui = EpicsGUI (ControllerAPI () , "DEVICE" )
2828
2929 assert gui ._get_pv ([], "A" ) == "DEVICE:A"
3030 assert gui ._get_pv (["B" ], "C" ) == "DEVICE:B:C"
@@ -42,8 +42,8 @@ def test_get_pv(controller_api):
4242 # (Waveform(array_dtype=np.int32), None),
4343 ],
4444)
45- def test_get_attribute_component_r (datatype , widget , controller_api ):
46- gui = EpicsGUI (controller_api , "DEVICE" )
45+ def test_get_attribute_component_r (datatype , widget ):
46+ gui = EpicsGUI (ControllerAPI () , "DEVICE" )
4747
4848 assert gui ._get_attribute_component ([], "Attr" , AttrR (datatype )) == SignalR (
4949 name = "Attr" , read_pv = "Attr" , read_widget = widget
@@ -60,16 +60,16 @@ def test_get_attribute_component_r(datatype, widget, controller_api):
6060 (Enum (ColourEnum ), ComboBox (choices = ["RED" , "GREEN" , "BLUE" ])),
6161 ],
6262)
63- def test_get_attribute_component_w (datatype , widget , controller_api ):
64- gui = EpicsGUI (controller_api , "DEVICE" )
63+ def test_get_attribute_component_w (datatype , widget ):
64+ gui = EpicsGUI (ControllerAPI () , "DEVICE" )
6565
6666 assert gui ._get_attribute_component ([], "Attr" , AttrW (datatype )) == SignalW (
6767 name = "Attr" , write_pv = "Attr" , write_widget = widget
6868 )
6969
7070
71- def test_get_attribute_component_none (mocker , controller_api ):
72- gui = EpicsGUI (controller_api , "DEVICE" )
71+ def test_get_attribute_component_none (mocker ):
72+ gui = EpicsGUI (ControllerAPI () , "DEVICE" )
7373
7474 mocker .patch .object (gui , "_get_read_widget" , return_value = None )
7575 mocker .patch .object (gui , "_get_write_widget" , return_value = None )
@@ -78,13 +78,13 @@ def test_get_attribute_component_none(mocker, controller_api):
7878 assert gui ._get_attribute_component ([], "Attr" , AttrRW (Int ())) is None
7979
8080
81- def test_get_read_widget_none (controller_api ):
82- gui = EpicsGUI (controller_api , "DEVICE" )
81+ def test_get_read_widget_none ():
82+ gui = EpicsGUI (ControllerAPI () , "DEVICE" )
8383 assert gui ._get_read_widget (fastcs_datatype = Waveform (np .int32 )) is None
8484
8585
86- def test_get_write_widget_none (controller_api ):
87- gui = EpicsGUI (controller_api , "DEVICE" )
86+ def test_get_write_widget_none ():
87+ gui = EpicsGUI (ControllerAPI () , "DEVICE" )
8888 assert gui ._get_write_widget (fastcs_datatype = Waveform (np .int32 )) is None
8989
9090
@@ -164,3 +164,12 @@ def test_get_components_none(mocker):
164164 components = gui .extract_api_components (controller_api )
165165
166166 assert components == []
167+
168+
169+ def test_get_command_component ():
170+ gui = EpicsGUI (ControllerAPI (), "DEVICE" )
171+
172+ component = gui ._get_command_component ([], "Command" )
173+
174+ assert isinstance (component , SignalX )
175+ assert component .write_widget == ButtonPanel (actions = {"Command" : "1" })
0 commit comments