File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 11import pytest
22
33from fastcs .attributes import AttrR
4- from fastcs .controller import Controller
4+ from fastcs .controller import Controller , ControllerVector
55from fastcs .datatypes import Float , Int
66
77
@@ -101,3 +101,18 @@ def __init__(self):
101101 ValueError , match = r"Cannot add attribute .* existing sub controller"
102102 ):
103103 controller .sub_controller = AttrR (Int ()) # pyright: ignore[reportAttributeAccessIssue]
104+
105+
106+ def test_controller_raises_error_if_passed_numeric_sub_controller_name ():
107+ sub_controller = SomeSubController ()
108+ controller = SomeController (sub_controller )
109+
110+ with pytest .raises (ValueError , match = "Numeric-only names are not allowed" ):
111+ controller .add_sub_controller ("30" , sub_controller )
112+
113+
114+ def test_controller_vector_raises_error_if_add_sub_controller_called ():
115+ controller_vector = ControllerVector ({i : SomeSubController () for i in range (2 )})
116+
117+ with pytest .raises (NotImplementedError , match = "Use __setitem__ instead" ):
118+ controller_vector .add_sub_controller ("subcontroller" , SomeSubController ())
You can’t perform that action at this time.
0 commit comments