diff --git a/tests/e2e/test_anchor_e2e.py b/tests/e2e/test_anchor_e2e.py index 119a915..420b4c0 100644 --- a/tests/e2e/test_anchor_e2e.py +++ b/tests/e2e/test_anchor_e2e.py @@ -10,8 +10,8 @@ from genalog.text import alignment, anchor, preprocess @pytest.mark.parametrize( "gt_file, ocr_file", zip( - sorted(glob.glob("tests/text/data/gt_*.txt")), - sorted(glob.glob("tests/text/data/ocr_*.txt")), + sorted(glob.glob("tests/unit/text/data/gt_*.txt")), + sorted(glob.glob("tests/unit/text/data/ocr_*.txt")), ), ) def test_align_w_anchor_and_align(gt_file, ocr_file): @@ -37,8 +37,8 @@ def test_align_w_anchor_and_align(gt_file, ocr_file): @pytest.mark.parametrize( "gt_file, ocr_file", zip( - sorted(glob.glob("tests/text/data/gt_*.txt")), - sorted(glob.glob("tests/text/data/ocr_*.txt")), + sorted(glob.glob("tests/unit/text/data/gt_*.txt")), + sorted(glob.glob("tests/unit/text/data/ocr_*.txt")), ), ) @pytest.mark.parametrize("max_seg_length", [25, 50, 75, 100, 150]) diff --git a/tests/e2e/test_document_generation.py b/tests/e2e/test_document_generation.py index fd65dd2..a3342c7 100644 --- a/tests/e2e/test_document_generation.py +++ b/tests/e2e/test_document_generation.py @@ -11,7 +11,7 @@ CONTENT = CompositeContent( UNSUPPORTED_CONTENT_FORMAT = ["foo bar"] UNSUPPORTED_CONTENT_TYPE = CompositeContent(["foo"], [ContentType.TITLE]) -CUSTOM_TEMPLATE_PATH = "tests/generation/templates" +CUSTOM_TEMPLATE_PATH = "tests/unit/generation/templates" CUSTOM_TEMPLATE_NAME = "mock.html.jinja" CUSTOM_STYLE_TEMPLATE_NAME = "font_family.html.jinja" MULTI_PAGE_TEMPLATE_NAME = "multipage.html.jinja" diff --git a/tests/e2e/test_pipeline.py b/tests/e2e/test_pipeline.py index 648797b..7d622ab 100644 --- a/tests/e2e/test_pipeline.py +++ b/tests/e2e/test_pipeline.py @@ -4,7 +4,7 @@ import pytest from genalog import pipeline -EXAMPLE_TEXT_FILE = "tests/text/data/gt_1.txt" +EXAMPLE_TEXT_FILE = "tests/unit/text/data/gt_1.txt" @pytest.fixture @@ -36,7 +36,7 @@ def test_custom_generate_img(custom_analog_generator): def test_generate_dataset_multiprocess(): - INPUT_TEXT_FILENAMES = glob.glob("tests/text/data/gt_*.txt") + INPUT_TEXT_FILENAMES = glob.glob("tests/unit/text/data/gt_*.txt") with pytest.deprecated_call(): pipeline.generate_dataset_multiprocess( INPUT_TEXT_FILENAMES, "test_out", {}, [], "text_block.html.jinja" diff --git a/tests/ocr/.env b/tests/ocr/.env deleted file mode 100644 index 866487c..0000000 --- a/tests/ocr/.env +++ /dev/null @@ -1,8 +0,0 @@ -COMPUTER_VISION_ENDPOINT = "https://enki-vision.cognitiveservices.azure.com/" -SEARCH_SERVICE_NAME = "ocr-ner-pipeline" -SKILLSET_NAME = "testocrskillset" -INDEX_NAME = "testocrindex" -INDEXER_NAME = "testocrindexer" -DATASOURCE_NAME = "syntheticimages" -DATASOURCE_CONTAINER_NAME = "testocrimages" -BLOB_NAME = "syntheticimages" diff --git a/tests/cases/__init__.py b/tests/unit/__init__.py similarity index 100% rename from tests/cases/__init__.py rename to tests/unit/__init__.py diff --git a/tests/unit/cases/__init__.py b/tests/unit/cases/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/cases/label_propagation.py b/tests/unit/cases/label_propagation.py similarity index 100% rename from tests/cases/label_propagation.py rename to tests/unit/cases/label_propagation.py diff --git a/tests/cases/text_alignment.py b/tests/unit/cases/text_alignment.py similarity index 100% rename from tests/cases/text_alignment.py rename to tests/unit/cases/text_alignment.py diff --git a/tests/degradation/test_degrader.py b/tests/unit/degradation/test_degrader.py similarity index 100% rename from tests/degradation/test_degrader.py rename to tests/unit/degradation/test_degrader.py diff --git a/tests/degradation/test_effect.py b/tests/unit/degradation/test_effect.py similarity index 100% rename from tests/degradation/test_effect.py rename to tests/unit/degradation/test_effect.py diff --git a/tests/generation/2x2.jpg b/tests/unit/generation/2x2.jpg similarity index 100% rename from tests/generation/2x2.jpg rename to tests/unit/generation/2x2.jpg diff --git a/tests/generation/templates/font_family.html.jinja b/tests/unit/generation/templates/font_family.html.jinja similarity index 100% rename from tests/generation/templates/font_family.html.jinja rename to tests/unit/generation/templates/font_family.html.jinja diff --git a/tests/generation/templates/mock.html.jinja b/tests/unit/generation/templates/mock.html.jinja similarity index 100% rename from tests/generation/templates/mock.html.jinja rename to tests/unit/generation/templates/mock.html.jinja diff --git a/tests/generation/templates/multipage.html.jinja b/tests/unit/generation/templates/multipage.html.jinja similarity index 100% rename from tests/generation/templates/multipage.html.jinja rename to tests/unit/generation/templates/multipage.html.jinja diff --git a/tests/generation/test_content.py b/tests/unit/generation/test_content.py similarity index 100% rename from tests/generation/test_content.py rename to tests/unit/generation/test_content.py diff --git a/tests/generation/test_document.py b/tests/unit/generation/test_document.py similarity index 98% rename from tests/generation/test_document.py rename to tests/unit/generation/test_document.py index 687657a..0dba729 100644 --- a/tests/generation/test_document.py +++ b/tests/unit/generation/test_document.py @@ -12,12 +12,12 @@ MOCK_COMPILED_DOCUMENT = "

populated document

" MOCK_TEMPLATE = MagicMock() MOCK_TEMPLATE.render.return_value = MOCK_COMPILED_DOCUMENT -IMG_BYTES = open("tests/generation/2x2.jpg", "rb").read() +IMG_BYTES = open("tests/unit/generation/2x2.jpg", "rb").read() FILE_DESTINATION_PDF = "sample.pdf" FILE_DESTINATION_PNG = "sample.png" -CUSTOM_TEMPLATE_PATH = "tests/generation/templates" +CUSTOM_TEMPLATE_PATH = "tests/unit/generation/templates" CUSTOM_TEMPLATE_NAME = "mock.html.jinja" DEFAULT_TEMPLATE_NAME = "text_block.html.jinja" DEFAULT_PACKAGE_NAME = "genalog.generation" diff --git a/tests/ocr/data/img/0.png b/tests/unit/ocr/data/img/0.png similarity index 100% rename from tests/ocr/data/img/0.png rename to tests/unit/ocr/data/img/0.png diff --git a/tests/ocr/data/img/1.png b/tests/unit/ocr/data/img/1.png similarity index 100% rename from tests/ocr/data/img/1.png rename to tests/unit/ocr/data/img/1.png diff --git a/tests/ocr/data/img/11.png b/tests/unit/ocr/data/img/11.png similarity index 100% rename from tests/ocr/data/img/11.png rename to tests/unit/ocr/data/img/11.png diff --git a/tests/ocr/data/json/521c38122f783673598856cd81d91c21_0.json b/tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_0.json similarity index 100% rename from tests/ocr/data/json/521c38122f783673598856cd81d91c21_0.json rename to tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_0.json diff --git a/tests/ocr/data/json/521c38122f783673598856cd81d91c21_1.json b/tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_1.json similarity index 100% rename from tests/ocr/data/json/521c38122f783673598856cd81d91c21_1.json rename to tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_1.json diff --git a/tests/ocr/data/json/521c38122f783673598856cd81d91c21_11.json b/tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_11.json similarity index 100% rename from tests/ocr/data/json/521c38122f783673598856cd81d91c21_11.json rename to tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_11.json diff --git a/tests/ocr/data/metrics.csv b/tests/unit/ocr/data/metrics.csv similarity index 100% rename from tests/ocr/data/metrics.csv rename to tests/unit/ocr/data/metrics.csv diff --git a/tests/ocr/data/metrics/json/123_001.json b/tests/unit/ocr/data/metrics/json/123_001.json similarity index 100% rename from tests/ocr/data/metrics/json/123_001.json rename to tests/unit/ocr/data/metrics/json/123_001.json diff --git a/tests/ocr/data/metrics/json/123_002.json b/tests/unit/ocr/data/metrics/json/123_002.json similarity index 100% rename from tests/ocr/data/metrics/json/123_002.json rename to tests/unit/ocr/data/metrics/json/123_002.json diff --git a/tests/ocr/data/metrics/json/123_003.json b/tests/unit/ocr/data/metrics/json/123_003.json similarity index 100% rename from tests/ocr/data/metrics/json/123_003.json rename to tests/unit/ocr/data/metrics/json/123_003.json diff --git a/tests/ocr/data/metrics/metrics.csv b/tests/unit/ocr/data/metrics/metrics.csv similarity index 100% rename from tests/ocr/data/metrics/metrics.csv rename to tests/unit/ocr/data/metrics/metrics.csv diff --git a/tests/ocr/data/metrics/substitution.pkl b/tests/unit/ocr/data/metrics/substitution.pkl similarity index 100% rename from tests/ocr/data/metrics/substitution.pkl rename to tests/unit/ocr/data/metrics/substitution.pkl diff --git a/tests/ocr/data/metrics/text/001.txt b/tests/unit/ocr/data/metrics/text/001.txt similarity index 100% rename from tests/ocr/data/metrics/text/001.txt rename to tests/unit/ocr/data/metrics/text/001.txt diff --git a/tests/ocr/data/metrics/text/002.txt b/tests/unit/ocr/data/metrics/text/002.txt similarity index 100% rename from tests/ocr/data/metrics/text/002.txt rename to tests/unit/ocr/data/metrics/text/002.txt diff --git a/tests/ocr/data/metrics/text/003.txt b/tests/unit/ocr/data/metrics/text/003.txt similarity index 100% rename from tests/ocr/data/metrics/text/003.txt rename to tests/unit/ocr/data/metrics/text/003.txt diff --git a/tests/ocr/data/substitution.json b/tests/unit/ocr/data/substitution.json similarity index 100% rename from tests/ocr/data/substitution.json rename to tests/unit/ocr/data/substitution.json diff --git a/tests/ocr/data/substitution.pkl b/tests/unit/ocr/data/substitution.pkl similarity index 100% rename from tests/ocr/data/substitution.pkl rename to tests/unit/ocr/data/substitution.pkl diff --git a/tests/ocr/data/text/0.txt b/tests/unit/ocr/data/text/0.txt similarity index 100% rename from tests/ocr/data/text/0.txt rename to tests/unit/ocr/data/text/0.txt diff --git a/tests/ocr/data/text/1.txt b/tests/unit/ocr/data/text/1.txt similarity index 100% rename from tests/ocr/data/text/1.txt rename to tests/unit/ocr/data/text/1.txt diff --git a/tests/ocr/data/text/11.txt b/tests/unit/ocr/data/text/11.txt similarity index 100% rename from tests/ocr/data/text/11.txt rename to tests/unit/ocr/data/text/11.txt diff --git a/tests/ocr/test_metrics.py b/tests/unit/ocr/test_metrics.py similarity index 100% rename from tests/ocr/test_metrics.py rename to tests/unit/ocr/test_metrics.py diff --git a/tests/ocr/test_ocr.py b/tests/unit/ocr/test_ocr.py similarity index 100% rename from tests/ocr/test_ocr.py rename to tests/unit/ocr/test_ocr.py diff --git a/tests/text/data/gt_1.txt b/tests/unit/text/data/gt_1.txt similarity index 100% rename from tests/text/data/gt_1.txt rename to tests/unit/text/data/gt_1.txt diff --git a/tests/text/data/gt_2.txt b/tests/unit/text/data/gt_2.txt similarity index 100% rename from tests/text/data/gt_2.txt rename to tests/unit/text/data/gt_2.txt diff --git a/tests/text/data/gt_3.txt b/tests/unit/text/data/gt_3.txt similarity index 100% rename from tests/text/data/gt_3.txt rename to tests/unit/text/data/gt_3.txt diff --git a/tests/text/data/label_generator/labels/0.tsv b/tests/unit/text/data/label_generator/labels/0.tsv similarity index 100% rename from tests/text/data/label_generator/labels/0.tsv rename to tests/unit/text/data/label_generator/labels/0.tsv diff --git a/tests/text/data/label_generator/labels/1.tsv b/tests/unit/text/data/label_generator/labels/1.tsv similarity index 100% rename from tests/text/data/label_generator/labels/1.tsv rename to tests/unit/text/data/label_generator/labels/1.tsv diff --git a/tests/text/data/label_generator/labels/11.tsv b/tests/unit/text/data/label_generator/labels/11.tsv similarity index 100% rename from tests/text/data/label_generator/labels/11.tsv rename to tests/unit/text/data/label_generator/labels/11.tsv diff --git a/tests/text/data/label_generator/text/0.txt b/tests/unit/text/data/label_generator/text/0.txt similarity index 100% rename from tests/text/data/label_generator/text/0.txt rename to tests/unit/text/data/label_generator/text/0.txt diff --git a/tests/text/data/label_generator/text/1.txt b/tests/unit/text/data/label_generator/text/1.txt similarity index 100% rename from tests/text/data/label_generator/text/1.txt rename to tests/unit/text/data/label_generator/text/1.txt diff --git a/tests/text/data/label_generator/text/11.txt b/tests/unit/text/data/label_generator/text/11.txt similarity index 100% rename from tests/text/data/label_generator/text/11.txt rename to tests/unit/text/data/label_generator/text/11.txt diff --git a/tests/text/data/ocr_1.txt b/tests/unit/text/data/ocr_1.txt similarity index 100% rename from tests/text/data/ocr_1.txt rename to tests/unit/text/data/ocr_1.txt diff --git a/tests/text/data/ocr_2.txt b/tests/unit/text/data/ocr_2.txt similarity index 100% rename from tests/text/data/ocr_2.txt rename to tests/unit/text/data/ocr_2.txt diff --git a/tests/text/data/ocr_3.txt b/tests/unit/text/data/ocr_3.txt similarity index 100% rename from tests/text/data/ocr_3.txt rename to tests/unit/text/data/ocr_3.txt diff --git a/tests/text/test_alignment.py b/tests/unit/text/test_alignment.py similarity index 97% rename from tests/text/test_alignment.py rename to tests/unit/text/test_alignment.py index 88ed70d..9aa44e7 100644 --- a/tests/text/test_alignment.py +++ b/tests/unit/text/test_alignment.py @@ -5,8 +5,8 @@ from unittest.mock import MagicMock import pytest from genalog.text import alignment -from tests.cases.text_alignment import ALIGNMENT_REGRESSION_TEST_CASES -from tests.cases.text_alignment import PARSE_ALIGNMENT_REGRESSION_TEST_CASES +from tests.unit.cases.text_alignment import ALIGNMENT_REGRESSION_TEST_CASES +from tests.unit.cases.text_alignment import PARSE_ALIGNMENT_REGRESSION_TEST_CASES RANDOM_INT = randint(1, 100) MOCK_ALIGNMENT_RESULT = [("X", "X", 0, 0, 1)] diff --git a/tests/text/test_anchor.py b/tests/unit/text/test_anchor.py similarity index 97% rename from tests/text/test_anchor.py rename to tests/unit/text/test_anchor.py index 0f8a789..92dd5a5 100644 --- a/tests/text/test_anchor.py +++ b/tests/unit/text/test_anchor.py @@ -4,7 +4,7 @@ import warnings import pytest from genalog.text import alignment, anchor, preprocess -from tests.cases.text_alignment import ALIGNMENT_REGRESSION_TEST_CASES +from tests.unit.cases.text_alignment import ALIGNMENT_REGRESSION_TEST_CASES @pytest.mark.parametrize( @@ -200,8 +200,8 @@ def test_find_anchor_recur_fixed_seg_len( @pytest.mark.parametrize( "gt_file, ocr_file", zip( - sorted(glob.glob("tests/text/data/gt_1.txt")), - sorted(glob.glob("tests/text/data/ocr_1.txt")), + sorted(glob.glob("tests/unit/text/data/gt_1.txt")), + sorted(glob.glob("tests/unit/text/data/ocr_1.txt")), ), ) @pytest.mark.parametrize("max_seg_length", [75]) diff --git a/tests/text/test_conll_format.py b/tests/unit/text/test_conll_format.py similarity index 100% rename from tests/text/test_conll_format.py rename to tests/unit/text/test_conll_format.py diff --git a/tests/text/test_lcs.py b/tests/unit/text/test_lcs.py similarity index 100% rename from tests/text/test_lcs.py rename to tests/unit/text/test_lcs.py diff --git a/tests/text/test_ner_label.py b/tests/unit/text/test_ner_label.py similarity index 99% rename from tests/text/test_ner_label.py rename to tests/unit/text/test_ner_label.py index c4c1891..ca337f1 100644 --- a/tests/text/test_ner_label.py +++ b/tests/unit/text/test_ner_label.py @@ -1,7 +1,7 @@ import pytest from genalog.text import ner_label -from tests.cases.label_propagation import LABEL_PROPAGATION_REGRESSION_TEST_CASES +from tests.unit.cases.label_propagation import LABEL_PROPAGATION_REGRESSION_TEST_CASES @pytest.mark.parametrize( diff --git a/tests/text/test_preprocess.py b/tests/unit/text/test_preprocess.py similarity index 100% rename from tests/text/test_preprocess.py rename to tests/unit/text/test_preprocess.py diff --git a/tests/text/test_utf8.py b/tests/unit/text/test_utf8.py similarity index 97% rename from tests/text/test_utf8.py rename to tests/unit/text/test_utf8.py index 0cb6b16..67afaa0 100644 --- a/tests/text/test_utf8.py +++ b/tests/unit/text/test_utf8.py @@ -5,7 +5,7 @@ import pytest from genalog.text import alignment from genalog.text.alignment import GAP_CHAR -from tests.cases.text_alignment import ALIGNMENT_REGRESSION_TEST_CASES +from tests.unit.cases.text_alignment import ALIGNMENT_REGRESSION_TEST_CASES def random_utf8_char(byte_len=1):