mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-08 22:40:40 +02:00
udpates client tests
This commit is contained in:
parent
fbada6d818
commit
f65a0e31c3
@ -1,5 +1,4 @@
|
|||||||
import threading
|
import threading
|
||||||
import time
|
|
||||||
from collections.abc import Generator
|
from collections.abc import Generator
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -19,6 +18,7 @@ def pydase_client() -> Generator[pydase.Client, None, Any]:
|
|||||||
self._name = "MyService"
|
self._name = "MyService"
|
||||||
self._my_property = 12.1
|
self._my_property = 12.1
|
||||||
self.sub_service = SubService()
|
self.sub_service = SubService()
|
||||||
|
self.list_attr = [1, 2]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def my_property(self) -> float:
|
def my_property(self) -> float:
|
||||||
@ -40,8 +40,6 @@ def pydase_client() -> Generator[pydase.Client, None, Any]:
|
|||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
client = pydase.Client(port=9999)
|
client = pydase.Client(port=9999)
|
||||||
while not client.proxy.connected:
|
|
||||||
time.sleep(0.001) # Wait for the client to connect
|
|
||||||
|
|
||||||
yield client
|
yield client
|
||||||
|
|
||||||
@ -79,3 +77,25 @@ def test_nested_service(pydase_client: pydase.Client) -> None:
|
|||||||
assert pydase_client.proxy.sub_service.name == "SubService"
|
assert pydase_client.proxy.sub_service.name == "SubService"
|
||||||
pydase_client.proxy.sub_service.name = "New name"
|
pydase_client.proxy.sub_service.name = "New name"
|
||||||
assert pydase_client.proxy.sub_service.name == "New name"
|
assert pydase_client.proxy.sub_service.name == "New name"
|
||||||
|
|
||||||
|
|
||||||
|
def test_list(pydase_client: pydase.Client) -> None:
|
||||||
|
assert pydase_client.proxy.list_attr == [1, 2]
|
||||||
|
|
||||||
|
pydase_client.proxy.list_attr.append(1)
|
||||||
|
assert pydase_client.proxy.list_attr == [1, 2, 1]
|
||||||
|
|
||||||
|
pydase_client.proxy.list_attr.extend([123, 2.1])
|
||||||
|
assert pydase_client.proxy.list_attr == [1, 2, 1, 123, 2.1]
|
||||||
|
|
||||||
|
pydase_client.proxy.list_attr.insert(1, 1.2)
|
||||||
|
assert pydase_client.proxy.list_attr == [1, 1.2, 2, 1, 123, 2.1]
|
||||||
|
|
||||||
|
assert pydase_client.proxy.list_attr.pop() == 2.1
|
||||||
|
assert pydase_client.proxy.list_attr == [1, 1.2, 2, 1, 123]
|
||||||
|
|
||||||
|
pydase_client.proxy.list_attr.remove(1.2)
|
||||||
|
assert pydase_client.proxy.list_attr == [1, 2, 1, 123]
|
||||||
|
|
||||||
|
pydase_client.proxy.list_attr.clear()
|
||||||
|
assert pydase_client.proxy.list_attr == []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user