diff --git a/src/fastcs/backends/epics/gui.py b/src/fastcs/backends/epics/gui.py index 66473f0d..a7562920 100644 --- a/src/fastcs/backends/epics/gui.py +++ b/src/fastcs/backends/epics/gui.py @@ -50,9 +50,8 @@ def __init__(self, mapping: Mapping, pv_prefix: str) -> None: self._pv_prefix = pv_prefix def _get_pv(self, attr_path: list[str], name: str): - attr_prefix = ":".join(attr_path) - pv_prefix = ":".join((self._pv_prefix, attr_prefix)) - return f"{pv_prefix}:{name.title().replace('_', '')}" + attr_prefix = ":".join([self._pv_prefix] + attr_path) + return f"{attr_prefix}:{name.title().replace('_', '')}" @staticmethod def _get_read_widget(datatype: DataType) -> ReadWidget: diff --git a/tests/backends/epics/test_gui.py b/tests/backends/epics/test_gui.py new file mode 100644 index 00000000..53ab7c01 --- /dev/null +++ b/tests/backends/epics/test_gui.py @@ -0,0 +1,11 @@ +from fastcs.backends.epics.gui import EpicsGUI +from fastcs.controller import Controller +from fastcs.mapping import Mapping + + +def test_get_pv(): + gui = EpicsGUI(Mapping(Controller()), "DEVICE") + + assert gui._get_pv([], "A") == "DEVICE:A" + assert gui._get_pv(["B"], "C") == "DEVICE:B:C" + assert gui._get_pv(["D", "E"], "F") == "DEVICE:D:E:F"