@@ -139,8 +139,11 @@ def test_embeddings_are_applied_on_elements(mocker):
139139 ],
140140)
141141def test_ingest (html_file_path , json_file_path ):
142- html_code = Path (html_file_path ).read_text ()
143- expected_json_elements = elements_from_json (json_file_path )
142+ html_file_path = Path (__file__ ).parent / html_file_path
143+ json_file_path = Path (__file__ ).parent / json_file_path
144+
145+ html_code = html_file_path .read_text ()
146+ expected_json_elements = elements_from_json (str (json_file_path ))
144147
145148 ontology = parse_html_to_ontology (html_code )
146149 unstructured_elements = ontology_to_unstructured_elements (ontology )
@@ -149,17 +152,19 @@ def test_ingest(html_file_path, json_file_path):
149152
150153@pytest .mark .parametrize ("json_file_path" , ["unstructured_json_output/example.json" ])
151154def test_parsed_ontology_can_be_serialized_from_json (json_file_path ):
152- expected_json_elements = elements_from_json (json_file_path )
155+ json_file_path = Path (__file__ ).parent / json_file_path
156+
157+ expected_json_elements = elements_from_json (str (json_file_path ))
153158
154- json_elements_text = Path ( json_file_path ) .read_text ()
159+ json_elements_text = json_file_path .read_text ()
155160 elements = partition_json (text = json_elements_text )
156161
157162 assert len (elements ) == len (expected_json_elements )
158163 for i in range (len (elements )):
159164 assert elements [i ] == expected_json_elements [i ]
160165 # The partitioning output comes from PDF file, so only stem is compared
161166 # as the suffix is different .pdf != .json
162- assert Path (elements [i ].metadata .filename ).stem == Path ( json_file_path ) .stem
167+ assert Path (elements [i ].metadata .filename ).stem == json_file_path .stem
163168
164169
165170@pytest .mark .parametrize (
@@ -169,8 +174,11 @@ def test_parsed_ontology_can_be_serialized_from_json(json_file_path):
169174 ],
170175)
171176def test_parsed_ontology_can_be_serialized_from_html (html_file_path , json_file_path ):
172- expected_json_elements = elements_from_json (json_file_path )
173- html_code = Path (html_file_path ).read_text ()
177+ html_file_path = Path (__file__ ).parent / html_file_path
178+ json_file_path = Path (__file__ ).parent / json_file_path
179+
180+ expected_json_elements = elements_from_json (str (json_file_path ))
181+ html_code = html_file_path .read_text ()
174182
175183 predicted_elements = partition_html (text = html_code , html_parser_version = "v2" )
176184 assert len (expected_json_elements ) == len (predicted_elements )
0 commit comments