Skip to content

Commit

Permalink
fix a fragile test and improve SyncNode eq
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier committed Sep 17, 2023
1 parent edbd481 commit 92fafdc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Binary file modified asyncua/binary_address_space.pickle
Binary file not shown.
2 changes: 2 additions & 0 deletions asyncua/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ def __init__(self, tloop: ThreadLoop, aio_node: node.Node):
self.tloop = tloop

def __eq__(self, other):
if not isinstance(other, SyncNode):
return False
return other is not None and self.aio_obj == other.aio_obj

def __ne__(self, other):
Expand Down
10 changes: 7 additions & 3 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ def test_sync_client_get_node(client, idx):
node = client.get_node(85)
assert node == client.nodes.objects
nodes = node.get_children()
assert len(nodes) > 2
assert nodes[0] == client.nodes.server
assert isinstance(nodes[0], SyncNode)
assert len(nodes) > 2

child = node.get_child(["0:Server"])
assert child == client.nodes.server

results = node.get_children_by_path([[f"{idx}:MyObject", f"{idx}:MyVariable"]])
assert len(results) == 1
Expand Down Expand Up @@ -177,9 +179,11 @@ def test_sync_server_get_node(server, idx):
assert node == server.nodes.objects
nodes = node.get_children()
assert len(nodes) > 2
assert nodes[0] == server.nodes.server
assert isinstance(nodes[0], SyncNode)

child = node.get_child(["0:Server"])
assert child == server.nodes.server

results = node.get_children_by_path([[f"{idx}:MyObject", f"{idx}:MyVariable"]])
assert len(results) == 1
vars = results[0]
Expand Down

0 comments on commit 92fafdc

Please sign in to comment.