Skip to content

Commit 4990122

Browse files
committed
fix(client): validate max_depth >= 1 in traverse(); xfail strict=True
- traverse(): raise ValueError locally when max_depth < 1 before RPC - test_traverse_inbound_direction: strict=True so CI catches unexpected XPASS when server adds inbound direction support - test_get_labels_has_property_definitions: document why the assertion is intentionally weak (schema-free labels may have empty properties)
1 parent 1e59f71 commit 4990122

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

coordinode/coordinode/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ async def traverse(
396396
key = direction.lower()
397397
if key not in _direction_map:
398398
raise ValueError(f"Invalid direction {direction!r}. Must be one of: 'outbound', 'inbound', 'both'.")
399+
if max_depth < 1:
400+
raise ValueError(f"max_depth must be >= 1, got {max_depth!r}.")
399401
direction_value = _direction_map[key]
400402

401403
req = TraverseRequest(

tests/integration/test_sdk.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ def test_get_labels_has_property_definitions(client):
234234
labels = client.get_labels()
235235
found = next((lbl for lbl in labels if lbl.name == "PropLabel"), None)
236236
assert found is not None, "PropLabel not returned by get_labels()"
237+
# Intentionally only check the type — CoordiNode is schema-free and may return
238+
# an empty properties list even when the node was created with properties.
237239
assert isinstance(found.properties, list)
238240
finally:
239241
client.cypher("MATCH (n:PropLabel {tag: $tag}) DETACH DELETE n", params={"tag": tag})
@@ -279,7 +281,7 @@ def test_traverse_returns_neighbours(client):
279281

280282

281283
@pytest.mark.xfail(
282-
strict=False,
284+
strict=True,
283285
reason="CoordiNode Traverse RPC does not yet support inbound direction — server returns empty result set",
284286
)
285287
def test_traverse_inbound_direction(client):

0 commit comments

Comments
 (0)