Skip to content

Improve error when raw-to-derived argument is declared without explicit type in derived_signal_rw #1108

@Villtord

Description

@Villtord

If I make a derived signal like this

self._internal_order = soft_signal_rw(int, initial_value=3)
self.order = derived_signal_rw(
                self._get_order,
                self._set_order,
                current_order = self._internal_order
                ) 

def _get_order(self, current_order) -> int:
        return current_order

async def _set_order(self, new_order: int) -> None:
    self._internal_order.set(new_order)

That is without specifying return Type of parameter in _get_order() function, then
I will get an error trying to read from this signal which is not really very clear
ERROR tests/devices/test_undulator.py::test_order_read - TypeError: Expected the following to be passed as keyword arguments {}, got {'current_order': <class 'int'>}
So looks like current_order argument has been excluded from _get_order function arguments.

Acceptance Criteria

  • Specific criteria that will be used to judge if the issue is fixed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions