2024-09-19 16:38:01 -07:00
|
|
|
# Copyright (c) 2024 Microsoft Corporation.
|
|
|
|
|
# Licensed under the MIT License
|
|
|
|
|
|
2024-12-05 09:57:26 -08:00
|
|
|
from graphrag.index.flows.create_final_relationships import (
|
|
|
|
|
create_final_relationships,
|
|
|
|
|
)
|
2024-09-19 16:38:01 -07:00
|
|
|
from graphrag.index.workflows.v1.create_final_relationships import (
|
|
|
|
|
workflow_name,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
from .util import (
|
|
|
|
|
compare_outputs,
|
2024-12-05 09:57:26 -08:00
|
|
|
load_test_table,
|
2024-09-19 16:38:01 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2024-12-05 09:57:26 -08:00
|
|
|
def test_create_final_relationships():
|
|
|
|
|
edges = load_test_table("base_relationship_edges")
|
|
|
|
|
expected = load_test_table(workflow_name)
|
2024-09-19 16:38:01 -07:00
|
|
|
|
2024-12-18 18:07:44 -08:00
|
|
|
actual = create_final_relationships(edges)
|
2024-09-19 16:38:01 -07:00
|
|
|
|
2024-12-05 09:57:26 -08:00
|
|
|
assert "id" in expected.columns
|
|
|
|
|
columns = list(expected.columns.values)
|
|
|
|
|
columns.remove("id")
|
|
|
|
|
compare_outputs(actual, expected, columns)
|
|
|
|
|
assert len(actual.columns) == len(expected.columns)
|