Restructure unit tests
|
@ -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])
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
До Ширина: | Высота: | Размер: 471 B После Ширина: | Высота: | Размер: 471 B |
|
@ -12,12 +12,12 @@ MOCK_COMPILED_DOCUMENT = "<p>populated document</p>"
|
|||
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"
|
До Ширина: | Высота: | Размер: 83 KiB После Ширина: | Высота: | Размер: 83 KiB |
До Ширина: | Высота: | Размер: 77 KiB После Ширина: | Высота: | Размер: 77 KiB |
До Ширина: | Высота: | Размер: 82 KiB После Ширина: | Высота: | Размер: 82 KiB |
|
@ -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)]
|
|
@ -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])
|
|
@ -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(
|
|
@ -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):
|