Skip to content

Commit 1e59f71

Browse files
committed
fix(client): correct schema type string representations
- PropertyDefinitionInfo: class name typo in string form corrected - LabelInfo, EdgeTypeInfo: include version field; summarise property count - Integration test: unique tag for label node; use DETACH DELETE cleanup - Integration test: replace skip with xfail for unsupported inbound direction
1 parent 80a73c6 commit 1e59f71

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

coordinode/coordinode/client.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ def __init__(self, proto_def: Any) -> None:
9595
self.unique: bool = proto_def.unique
9696

9797
def __repr__(self) -> str:
98-
return (
99-
f"PropertyDefinition(name={self.name!r}, type={self.type}, required={self.required}, unique={self.unique})"
100-
)
98+
return f"PropertyDefinitionInfo(name={self.name!r}, type={self.type}, required={self.required}, unique={self.unique})"
10199

102100

103101
class LabelInfo:
@@ -109,7 +107,7 @@ def __init__(self, proto_label: Any) -> None:
109107
self.properties: list[PropertyDefinitionInfo] = [PropertyDefinitionInfo(p) for p in proto_label.properties]
110108

111109
def __repr__(self) -> str:
112-
return f"LabelInfo(name={self.name!r}, properties={self.properties})"
110+
return f"LabelInfo(name={self.name!r}, version={self.version}, properties={len(self.properties)})"
113111

114112

115113
class EdgeTypeInfo:
@@ -121,7 +119,7 @@ def __init__(self, proto_edge_type: Any) -> None:
121119
self.properties: list[PropertyDefinitionInfo] = [PropertyDefinitionInfo(p) for p in proto_edge_type.properties]
122120

123121
def __repr__(self) -> str:
124-
return f"EdgeTypeInfo(name={self.name!r}, properties={self.properties})"
122+
return f"EdgeTypeInfo(name={self.name!r}, version={self.version}, properties={len(self.properties)})"
125123

126124

127125
class TraverseResult:

tests/integration/test_sdk.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,15 @@ def test_get_labels_returns_list(client):
228228

229229
def test_get_labels_has_property_definitions(client):
230230
"""LabelInfo.properties is a list (may be empty for schema-free labels)."""
231-
client.cypher("MERGE (n:PropLabel {name: 'probe'})")
231+
tag = uid()
232+
client.cypher("CREATE (n:PropLabel {tag: $tag})", params={"tag": tag})
232233
try:
233234
labels = client.get_labels()
234235
found = next((lbl for lbl in labels if lbl.name == "PropLabel"), None)
235236
assert found is not None, "PropLabel not returned by get_labels()"
236237
assert isinstance(found.properties, list)
237238
finally:
238-
client.cypher("MATCH (n:PropLabel {name: 'probe'}) DELETE n")
239+
client.cypher("MATCH (n:PropLabel {tag: $tag}) DETACH DELETE n", params={"tag": tag})
239240

240241

241242
def test_get_edge_types_returns_list(client):
@@ -277,8 +278,9 @@ def test_traverse_returns_neighbours(client):
277278
client.cypher("MATCH (n:TraverseRPC {tag: $tag}) DETACH DELETE n", params={"tag": tag})
278279

279280

280-
@pytest.mark.skip(
281-
reason="CoordiNode Traverse RPC does not yet support inbound direction — server returns empty result set"
281+
@pytest.mark.xfail(
282+
strict=False,
283+
reason="CoordiNode Traverse RPC does not yet support inbound direction — server returns empty result set",
282284
)
283285
def test_traverse_inbound_direction(client):
284286
"""traverse() with direction='inbound' reaches nodes that point TO start_id."""

0 commit comments

Comments
 (0)