88
99from fastcs .attributes import AttrR
1010from fastcs .backends .tango .backend import TangoBackend
11- from fastcs .datatypes import Bool , Float , Int
11+ from fastcs .datatypes import Bool , Float , Int , String
1212
1313
1414def pascal_2_snake (input : list [str ]) -> list [str ]:
15+ """
16+ Converts the last entry in a list of strings
17+ """
1518 snake_list = copy .deepcopy (input )
1619 snake_list [- 1 ] = re .sub (r"(?<!^)(?=[A-Z])" , "_" , snake_list [- 1 ]).lower ()
1720 return snake_list
@@ -24,6 +27,7 @@ def setup_class(self, assertable_controller):
2427
2528 @pytest .fixture (scope = "class" )
2629 def tango_context (self ):
30+ # https://tango-controls.readthedocs.io/projects/pytango/en/v9.5.1/testing/test_context.html
2731 device = TangoBackend (self .controller )._dsr ._device
2832 with DeviceTestContext (device ) as proxy :
2933 yield proxy
@@ -103,8 +107,10 @@ def test_read_bool(self, client_read):
103107 def test_write_bool (self , client_write ):
104108 client_write (["WriteBool" ], AttrR (Bool ())._value )
105109
106- # # We need to discuss enums
107- # def test_string_enum(self, client_read, client_write):
110+ def test_string_enum (self , client_read , client_write ):
111+ enum = AttrR (String (), allowed_values = ["red" , "green" , "blue" ])._value
112+ client_read (["StringEnum" ], enum )
113+ client_write (["StringEnum" ], enum )
108114
109115 def test_big_enum (self , client_read ):
110116 client_read (["BigEnum" ], AttrR (Int (), allowed_values = list (range (1 , 18 )))._value )
0 commit comments