Skip to content

Commit c244ca4

Browse files
test_get_point_position
1 parent b704167 commit c244ca4

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ def print_log(self):
4949
output += line
5050
print(output)
5151

52+
def get_response(self):
53+
response = eval(self.ws.recv())
54+
return response
55+
5256
def compare_image(self, nb_messages, path_image):
5357
for i in range(nb_messages):
5458
print(f"{i=}", flush=True)

tests/test_protocol.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ def test_get_point_position(server):
8181
abs_path = os.path.join(images_dir_path, "get_point_position.jpeg")
8282
assert server.compare_image(3, abs_path) == True
8383

84-
assert server.compare_image(3, abs_path) == True
85-
response = server.call("get_point_position", [{"x": 0, "y": 0}])
86-
print(f"{response=}", flush=True)
87-
assert "x" in response
88-
x = response["x"]
89-
print(f"{x=}", flush=True)
90-
assert type(x) is int
91-
assert "y" in response
92-
assert "z" in response
93-
94-
print(response, flush=True)
84+
server.call("get_point_position", [{"x": 0, "y": 0}])
85+
response = server.get_response()
86+
assert "x" in response["result"]
87+
assert "y" in response["result"]
88+
assert "z" in response["result"]
89+
x = response["result"]["x"]
90+
y = response["result"]["y"]
91+
z = response["result"]["z"]
92+
assert type(x) is float
93+
assert type(y) is float
94+
assert type(z) is float

0 commit comments

Comments
 (0)