Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions tests/test_numpy_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def action_with_arrays(self, a: NDArray) -> NDArray:
def read_array(self) -> NDArray:
return np.array([1, 2])

@lt.property
def array_property(self) -> NDArray:
return np.array([3, 4, 5])


def test_thing_description():
"""Make sure the TD validates when numpy types are used."""
Expand Down Expand Up @@ -115,6 +119,8 @@ def test_numpy_over_http():
with TestClient(server.app) as client:
np_thing_client = lt.ThingClient.from_url("/np_thing/", client=client)

arrayprop = np_thing_client.array_property
assert np.array_equal(np.asarray(arrayprop), np.array([3, 4, 5]))

array = np_thing_client.read_array()
assert isinstance(array, np.ndarray)
assert np.array_equal(array, np.array([1, 2]))
assert np.array_equal(np.asarray(array), np.array([1, 2]))
Loading