From 93fae83a09f68e9a068fd08989d49e1aa512a39b Mon Sep 17 00:00:00 2001 From: Ben Browning Date: Fri, 8 Nov 2024 13:15:15 -0500 Subject: [PATCH] Consolidate test sample documents into one subdir This gets rid of the extra testdata directory for functional tests and collapses those into a single one, using the existing sample_documents subdir of the unit tests. Signed-off-by: Ben Browning --- tests/functional/test_chunkers.py | 7 ++++--- .../sample_documents}/phoenix.md | 0 .../sample_documents}/phoenix.pdf | Bin 3 files changed, 4 insertions(+), 3 deletions(-) rename tests/{functional/testdata => testdata/sample_documents}/phoenix.md (100%) rename tests/{functional/testdata => testdata/sample_documents}/phoenix.pdf (100%) diff --git a/tests/functional/test_chunkers.py b/tests/functional/test_chunkers.py index 4fa83859..30b0a28b 100644 --- a/tests/functional/test_chunkers.py +++ b/tests/functional/test_chunkers.py @@ -5,14 +5,15 @@ # First Party from instructlab.sdg.utils.chunkers import DocumentChunker -TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "testdata") +TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "..", "testdata") def test_chunk_pdf(tmp_path): + pdf_path = Path(os.path.join(TEST_DATA_DIR, "sample_documents", "phoenix.pdf")) leaf_node = [ { "documents": ["Lorem ipsum"], - "filepaths": [Path(os.path.join(TEST_DATA_DIR, "phoenix.pdf"))], + "filepaths": [pdf_path], "taxonomy_path": "knowledge", } ] @@ -33,7 +34,7 @@ def test_chunk_pdf(tmp_path): def test_chunk_md(tmp_path): - markdown_path = Path(os.path.join(TEST_DATA_DIR, "phoenix.md")) + markdown_path = Path(os.path.join(TEST_DATA_DIR, "sample_documents", "phoenix.md")) leaf_node = [ { "documents": [markdown_path.read_text(encoding="utf-8")], diff --git a/tests/functional/testdata/phoenix.md b/tests/testdata/sample_documents/phoenix.md similarity index 100% rename from tests/functional/testdata/phoenix.md rename to tests/testdata/sample_documents/phoenix.md diff --git a/tests/functional/testdata/phoenix.pdf b/tests/testdata/sample_documents/phoenix.pdf similarity index 100% rename from tests/functional/testdata/phoenix.pdf rename to tests/testdata/sample_documents/phoenix.pdf