Skip to content

Commit dbe58fb

Browse files
committed
Process review comments
1 parent 3b4fb01 commit dbe58fb

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/fastcs/backends/tango/dsr.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from collections.abc import Awaitable, Callable
22
from dataclasses import dataclass
3-
from types import MethodType
43
from typing import Any
54

65
import tango

tests/backends/tango/test_dsr.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88

99
from fastcs.attributes import AttrR
1010
from 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

1414
def 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)

tests/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ def __init__(self, mocker: MockerFixture) -> None:
105105
def assertPerformed(
106106
self, path: list[str], action: Literal["READ", "WRITE", "EXECUTE"]
107107
):
108+
"""
109+
This context manager can be used to confirm that a fastcs
110+
controller's respective attribute or command methods are called
111+
a single time witin the context block
112+
"""
108113
queue = copy.deepcopy(path)
109114
match action:
110115
case "READ":

0 commit comments

Comments
 (0)