mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-25 02:20:02 +02:00
35 lines
854 B
Python
35 lines
854 B
Python
from pytest import CaptureFixture
|
|
|
|
from pyDataInterface import DataService
|
|
|
|
|
|
def test_properties(capsys: CaptureFixture) -> None:
|
|
class ServiceClass(DataService):
|
|
_power = True
|
|
|
|
@property
|
|
def power(self) -> bool:
|
|
return self._power
|
|
|
|
@power.setter
|
|
def power(self, value: bool) -> None:
|
|
self._power = value
|
|
|
|
@property
|
|
def power_two(self) -> bool:
|
|
return self._power
|
|
|
|
test_service = ServiceClass()
|
|
test_service.power = False
|
|
|
|
captured = capsys.readouterr()
|
|
expected_output = sorted(
|
|
[
|
|
"ServiceClass.power = False",
|
|
"ServiceClass.power_two = False",
|
|
"ServiceClass._power = False",
|
|
]
|
|
)
|
|
actual_output = sorted(captured.out.strip().split("\n"))
|
|
assert actual_output == expected_output
|