From 7c6c8e02eabdbe948cbf04df1afe7106b9b100c4 Mon Sep 17 00:00:00 2001 From: Steve Canny Date: Sun, 8 Dec 2024 17:09:39 -0800 Subject: [PATCH] fix: avoid "test" prefix in test util fn --- test_unstructured/chunking/test_title.py | 12 ++++++------ test_unstructured/unit_utils.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test_unstructured/chunking/test_title.py b/test_unstructured/chunking/test_title.py index fabdae47b1..443b073755 100644 --- a/test_unstructured/chunking/test_title.py +++ b/test_unstructured/chunking/test_title.py @@ -8,7 +8,7 @@ import pytest -from test_unstructured.unit_utils import FixtureRequest, Mock, function_mock, testfile_path +from test_unstructured.unit_utils import FixtureRequest, Mock, function_mock, input_path from unstructured.chunking.base import CHUNK_MULTI_PAGE_DEFAULT from unstructured.chunking.title import _ByTitleChunkingOptions, chunk_by_title from unstructured.documents.coordinates import CoordinateSystem @@ -36,7 +36,7 @@ def test_it_chunks_text_followed_by_table_together_when_both_fit(): - elements = elements_from_json(testfile_path("chunking/title_table_200.json")) + elements = elements_from_json(input_path("chunking/title_table_200.json")) chunks = chunk_by_title(elements, combine_text_under_n_chars=0) @@ -45,7 +45,7 @@ def test_it_chunks_text_followed_by_table_together_when_both_fit(): def test_it_chunks_table_followed_by_text_together_when_both_fit(): - elements = elements_from_json(testfile_path("chunking/table_text_200.json")) + elements = elements_from_json(input_path("chunking/table_text_200.json")) # -- disable chunk combining so we test pre-chunking behavior, not chunk-combining -- chunks = chunk_by_title(elements, combine_text_under_n_chars=0) @@ -55,7 +55,7 @@ def test_it_chunks_table_followed_by_text_together_when_both_fit(): def test_it_splits_oversized_table(): - elements = elements_from_json(testfile_path("chunking/table_2000.json")) + elements = elements_from_json(input_path("chunking/table_2000.json")) chunks = chunk_by_title(elements) @@ -64,7 +64,7 @@ def test_it_splits_oversized_table(): def test_it_starts_new_chunk_for_table_after_full_text_chunk(): - elements = elements_from_json(testfile_path("chunking/long_text_table_200.json")) + elements = elements_from_json(input_path("chunking/long_text_table_200.json")) chunks = chunk_by_title(elements, max_characters=250) @@ -73,7 +73,7 @@ def test_it_starts_new_chunk_for_table_after_full_text_chunk(): def test_it_starts_new_chunk_for_text_after_full_table_chunk(): - elements = elements_from_json(testfile_path("chunking/full_table_long_text_250.json")) + elements = elements_from_json(input_path("chunking/full_table_long_text_250.json")) chunks = chunk_by_title(elements, max_characters=250) diff --git a/test_unstructured/unit_utils.py b/test_unstructured/unit_utils.py index 9610e0a27f..a3565dcd9d 100644 --- a/test_unstructured/unit_utils.py +++ b/test_unstructured/unit_utils.py @@ -101,7 +101,7 @@ def parse_optional_datetime(datetime_str: Optional[str]) -> Optional[dt.datetime return dt.datetime.fromisoformat(datetime_str) if datetime_str else None -def testfile_path(rel_path: str) -> str: +def input_path(rel_path: str) -> str: """Resolve the absolute-path to `rel_path` in the testfiles directory.""" testfiles_dir = pathlib.Path(__file__).parent / "testfiles" file_path = testfiles_dir / rel_path