Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 3098f2a

Browse files
committed
Fix lint and add test to provide missing code coverage for one branch.
1 parent 02f5894 commit 3098f2a

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

tests/unit/test_graph_server.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def test_convert_schema():
668668
]
669669

670670
assert len(result["labels"]) == 2
671-
labels = {l["name"]: l for l in result["labels"]}
671+
labels = {label["name"]: label for label in result["labels"]}
672672
assert "Person" in labels
673673
assert "name" in labels["Person"]["propertyDeclarationNames"]
674674
assert "KNOWS" in labels
@@ -696,3 +696,42 @@ def test_convert_schema_empty():
696696
assert result["edgeTables"] == []
697697
assert result["labels"] == []
698698
assert result["propertyDeclarations"] == []
699+
700+
701+
def test_convert_schema_shared_label():
702+
"""Test _convert_schema where multiple tables share the same label."""
703+
input_schema = {
704+
"propertyGraphReference": {"propertyGraphId": "SharedLabelGraph"},
705+
"nodeTables": [
706+
{
707+
"name": "PersonA",
708+
"dataSourceTable": {"tableId": "TableA"},
709+
"labelAndProperties": [
710+
{
711+
"label": "Person",
712+
"properties": [{"name": "id", "dataType": {"typeKind": "INT64"}, "expression": "id"}],
713+
}
714+
],
715+
},
716+
{
717+
"name": "PersonB",
718+
"dataSourceTable": {"tableId": "TableB"},
719+
"labelAndProperties": [
720+
{
721+
"label": "Person",
722+
"properties": [{"name": "name", "dataType": {"typeKind": "STRING"}, "expression": "name"}],
723+
}
724+
],
725+
}
726+
],
727+
"edgeTables": [],
728+
}
729+
730+
schema_json = json.dumps(input_schema)
731+
result_json = graph_server._convert_schema(schema_json)
732+
result = json.loads(result_json)
733+
734+
# Verify that the 'Person' label includes properties from both tables
735+
labels = {l["name"]: l for l in result["labels"]}
736+
assert "Person" in labels
737+
assert set(labels["Person"]["propertyDeclarationNames"]) == {"id", "name"}

0 commit comments

Comments
 (0)