Skip to content

Commit d244774

Browse files
committed
Add UT to make sure we're not pruning the lexical graph
1 parent 10aaef5 commit d244774

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/unit/experimental/components/test_graph_pruning.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939

4040
@pytest.fixture(scope="module")
4141
def lexical_graph_config() -> LexicalGraphConfig:
42-
return LexicalGraphConfig()
42+
return LexicalGraphConfig(
43+
chunk_node_label="Paragraph",
44+
)
4345

4446

4547
@pytest.mark.parametrize(
@@ -165,6 +167,20 @@ def test_graph_pruning_validate_node(
165167
assert result is None
166168

167169

170+
def test_graph_pruning_enforce_nodes_lexical_graph(lexical_graph_config: LexicalGraphConfig) -> None:
171+
pruner = GraphPruning()
172+
result = pruner._enforce_nodes(
173+
extracted_nodes=[
174+
Neo4jNode(id="1", label="Paragraph"),
175+
],
176+
schema=GraphSchema(additional_node_types=False),
177+
lexical_graph_config=lexical_graph_config,
178+
pruning_stats=PruningStats(),
179+
)
180+
assert len(result) == 1
181+
assert result[0].label == "Paragraph"
182+
183+
168184
@pytest.fixture
169185
def neo4j_relationship() -> Neo4jRelationship:
170186
return Neo4jRelationship(

0 commit comments

Comments
 (0)