@@ -55,9 +55,18 @@ def test_local_fixture_loads_independently_of_s3_path():
5555def test_graph_output_relationships_contain_required_fields ():
5656 data = load_json_file (FIXTURE_PATH )
5757 graph = GraphInput .model_validate (data )
58- empty_results : Dict [str , Any ] = defaultdict (lambda : defaultdict (list ))
5958
60- output = build_node_structure (graph .entities , empty_results , graph .relationships )
59+ from src .models .graph_models import Occurrence
60+
61+ mock_occurrence = Occurrence (link = "mock" , context = "mock" )
62+
63+ class MockAliasDict (dict ):
64+ def get (self , key , default = None ):
65+ return [mock_occurrence ]
66+
67+ mock_results : Dict [str , Any ] = defaultdict (MockAliasDict )
68+
69+ output = build_node_structure (graph .entities , mock_results , graph .relationships )
6170 dumped = output .model_dump (exclude_none = True )
6271
6372 assert len (dumped ["relationships" ]) > 0
@@ -70,9 +79,18 @@ def test_graph_output_relationships_contain_required_fields():
7079def test_relationship_edges_reference_existing_nodes ():
7180 data = load_json_file (FIXTURE_PATH )
7281 graph = GraphInput .model_validate (data )
73- empty_results : Dict [str , Any ] = defaultdict (lambda : defaultdict (list ))
7482
75- output = build_node_structure (graph .entities , empty_results , graph .relationships )
83+ from src .models .graph_models import Occurrence
84+
85+ mock_occurrence = Occurrence (link = "mock" , context = "mock" )
86+
87+ class MockAliasDict (dict ):
88+ def get (self , key , default = None ):
89+ return [mock_occurrence ]
90+
91+ mock_results : Dict [str , Any ] = defaultdict (MockAliasDict )
92+
93+ output = build_node_structure (graph .entities , mock_results , graph .relationships )
7694 dumped = output .model_dump (exclude_none = True )
7795
7896 node_ids = {n ["data" ]["id" ] for n in dumped ["nodes" ]}
0 commit comments