Skip to content

Commit

Permalink
Fixed tests import statements
Browse files Browse the repository at this point in the history
  • Loading branch information
TaperChipmunk32 committed Oct 23, 2024
1 parent d8aa049 commit 186527d
Show file tree
Hide file tree
Showing 23 changed files with 24 additions and 37 deletions.
2 changes: 1 addition & 1 deletion tests/corpora/test_dbl_bundle_text_corpus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from testutils.dbl_bundle_test_environment import DblBundleTestEnvironment
from tests.testutils.dbl_bundle_test_environment import DblBundleTestEnvironment


def test_texts() -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/corpora/test_paratext_backup_terms_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
from tempfile import TemporaryDirectory
from typing import List

from testutils.corpora_test_helpers import create_test_paratext_backup

from machine.corpora import ParatextBackupTermsCorpus, TextRow
from tests.testutils.corpora_test_helpers import create_test_paratext_backup


def test_create_corpus():
Expand Down
3 changes: 1 addition & 2 deletions tests/corpora/test_paratext_backup_text_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
from tempfile import TemporaryDirectory
from typing import Any, ContextManager

from testutils.corpora_test_helpers import create_test_paratext_backup

from machine.corpora import ParatextBackupTextCorpus
from tests.testutils.corpora_test_helpers import create_test_paratext_backup


def test_texts() -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/corpora/test_scripture_text_corpus.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from testutils.corpora_test_helpers import USFM_TEST_PROJECT_PATH

from machine.corpora import ParatextTextCorpus, extract_scripture_corpus
from machine.scripture import ORIGINAL_VERSIFICATION, VerseRef
from tests.testutils.corpora_test_helpers import USFM_TEST_PROJECT_PATH


def test_extract_scripture_corpus() -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/corpora/test_text_file_text.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from testutils.corpora_test_helpers import TEXT_TEST_PROJECT_PATH

from machine.corpora import MultiKeyRef, TextFileTextCorpus, TextRowFlags
from tests.testutils.corpora_test_helpers import TEXT_TEST_PROJECT_PATH


def test_get_rows_nonempty_text_refs() -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/corpora/test_text_file_text_corpus.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pytest import raises
from testutils.corpora_test_helpers import TEXT_TEST_PROJECT_PATH

from machine.corpora import TextFileTextCorpus
from tests.testutils.corpora_test_helpers import TEXT_TEST_PROJECT_PATH


def test_does_not_exist() -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/corpora/test_update_usfm_parser_handler.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import List, Optional, Sequence, Tuple

from testutils.corpora_test_helpers import USFM_TEST_PROJECT_PATH, ignore_line_endings

from machine.corpora import FileParatextProjectTextUpdater, ScriptureRef, UpdateUsfmParserHandler, parse_usfm
from tests.testutils.corpora_test_helpers import USFM_TEST_PROJECT_PATH, ignore_line_endings


def test_get_usfm_verse_char_style() -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/corpora/test_usfm_file_text.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from testutils.corpora_test_helpers import USFM_TEST_PROJECT_PATH, scripture_ref

from machine.corpora import ScriptureRef, UsfmFileTextCorpus
from tests.testutils.corpora_test_helpers import USFM_TEST_PROJECT_PATH, scripture_ref


def test_get_rows_nonempty_text() -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/corpora/test_usfm_file_text_corpus.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from testutils.corpora_test_helpers import USFM_TEST_PROJECT_PATH

from machine.corpora import UsfmFileTextCorpus
from tests.testutils.corpora_test_helpers import USFM_TEST_PROJECT_PATH


def test_texts() -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/corpora/test_usfm_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import List, Optional, Tuple

import pytest
from testutils.corpora_test_helpers import TEST_DATA_PATH, USFM_SOURCE_PROJECT_PATH, USFM_TARGET_PROJECT_PATH

from machine.corpora import (
FileParatextProjectSettingsParser,
Expand All @@ -16,6 +15,7 @@
ZipParatextProjectSettingsParser,
ZipParatextProjectTextUpdater,
)
from tests.testutils.corpora_test_helpers import TEST_DATA_PATH, USFM_SOURCE_PROJECT_PATH, USFM_TARGET_PROJECT_PATH


@pytest.mark.skip(reason="This is for manual testing only. Remove this decorator to run the test.")
Expand Down
3 changes: 1 addition & 2 deletions tests/corpora/test_usfm_memory_text.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import List

from testutils.corpora_test_helpers import scripture_ref

from machine.corpora import ScriptureRef, TextRow, UsfmMemoryText, UsfmStylesheet
from tests.testutils.corpora_test_helpers import scripture_ref


def test_get_rows_verse_descriptive_title() -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/corpora/test_usfm_tokenizer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from testutils.corpora_test_helpers import USFM_TEST_PROJECT_PATH

from machine.corpora import UsfmTokenizer, UsfmTokenType
from tests.testutils.corpora_test_helpers import USFM_TEST_PROJECT_PATH


def test_tokenize() -> None:
Expand Down
5 changes: 2 additions & 3 deletions tests/corpora/test_usx_zip_text.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from testutils.corpora_test_helpers import scripture_ref
from testutils.dbl_bundle_test_environment import DblBundleTestEnvironment

from machine.corpora import ScriptureRef
from tests.testutils.corpora_test_helpers import scripture_ref
from tests.testutils.dbl_bundle_test_environment import DblBundleTestEnvironment


def test_get_rows_nonempty_text() -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/jobs/test_nmt_engine_build_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from decoy import Decoy, matchers
from pytest import raises
from testutils.mock_settings import MockSettings

from machine.annotations import Range
from machine.corpora import DictionaryTextCorpus
Expand All @@ -27,6 +26,7 @@
WordAlignmentMatrix,
)
from machine.utils import CanceledError, ContextManagedGenerator
from tests.testutils.mock_settings import MockSettings


def test_run(decoy: Decoy) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/jobs/test_smt_engine_build_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from decoy import Decoy, matchers
from pytest import raises
from testutils.mock_settings import MockSettings

from machine.annotations import Range
from machine.corpora import DictionaryTextCorpus, MemoryText, TextRow
Expand All @@ -23,6 +22,7 @@
)
from machine.translation.translation_engine import TranslationEngine
from machine.utils import CanceledError, ContextManagedGenerator
from tests.testutils.mock_settings import MockSettings


def test_run(decoy: Decoy) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/jobs/test_word_alignment_build_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

from decoy import Decoy, matchers
from pytest import raises
from testutils.mock_settings import MockSettings

from machine.corpora import DictionaryTextCorpus, MemoryText, TextRow
from machine.jobs import DictToJsonWriter, WordAlignmentBuildJob, WordAlignmentModelFactory
from machine.jobs.word_alignment_file_service import WordAlignmentFileService
from machine.translation import Trainer, TrainStats, WordAlignmentMatrix
from machine.translation.word_alignment_model import WordAlignmentModel
from machine.utils import CanceledError
from tests.testutils.mock_settings import MockSettings


def test_run(decoy: Decoy) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/scripture/test_versification.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from io import BytesIO, StringIO

from pytest import raises
from testutils.corpora_test_helpers import CUSTOM_VERS_PATH

from machine.scripture import ENGLISH_VERSIFICATION, ORIGINAL_VERSIFICATION, VerseRef, Versification
from tests.testutils.corpora_test_helpers import CUSTOM_VERS_PATH


def test_parse_valid() -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from tempfile import TemporaryDirectory

from pytest import approx, raises
from testutils.thot_test_helpers import TOY_CORPUS_FAST_ALIGN_PATH

from machine.translation import WordAlignmentMatrix
from machine.translation.thot import ThotFastAlignWordAlignmentModel, ThotSymmetrizedWordAlignmentModel
from tests.testutils.thot_test_helpers import TOY_CORPUS_FAST_ALIGN_PATH

DIRECT_MODEL_PATH = TOY_CORPUS_FAST_ALIGN_PATH / "tm" / "src_trg_invswm"
INVERSE_MODEL_PATH = TOY_CORPUS_FAST_ALIGN_PATH / "tm" / "src_trg_swm"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pytest import approx
from testutils.thot_test_helpers import TOY_CORPUS_HMM_PATH, create_test_parallel_corpus

from machine.translation import WordAlignmentMatrix
from machine.translation.thot import ThotHmmWordAlignmentModel, ThotSymmetrizedWordAlignmentModel
from tests.testutils.thot_test_helpers import TOY_CORPUS_HMM_PATH, create_test_parallel_corpus

DIRECT_MODEL_PATH = TOY_CORPUS_HMM_PATH / "tm" / "src_trg_invswm"
INVERSE_MODEL_PATH = TOY_CORPUS_HMM_PATH / "tm" / "src_trg_swm"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import Dict, List

from testutils.thot_test_helpers import create_test_parallel_corpus

from machine.translation import WordAlignmentMatrix
from machine.translation.thot import ThotIbm4WordAlignmentModel
from tests.testutils.thot_test_helpers import create_test_parallel_corpus


def test_create_trainer() -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/translation/thot/test_thot_smt_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from tempfile import TemporaryDirectory

from pytest import raises
from testutils.thot_test_helpers import TOY_CORPUS_FAST_ALIGN_CONFIG_FILENAME, TOY_CORPUS_HMM_CONFIG_FILENAME

from machine.translation.thot import ThotSmtModel, ThotSmtParameters, ThotWordAlignmentModelType
from tests.testutils.thot_test_helpers import TOY_CORPUS_FAST_ALIGN_CONFIG_FILENAME, TOY_CORPUS_HMM_CONFIG_FILENAME


def test_translate_target_segment_hmm() -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/translation/thot/test_thot_smt_model_trainer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os
from tempfile import TemporaryDirectory

from translation.thot.thot_model_trainer_helper import get_emtpy_parallel_corpus, get_parallel_corpus

from machine.translation.thot import ThotSmtModel, ThotSmtModelTrainer, ThotSmtParameters, ThotWordAlignmentModelType
from tests.translation.thot.thot_model_trainer_helper import get_emtpy_parallel_corpus, get_parallel_corpus


def test_train_non_empty_corpus() -> None:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from pathlib import Path
from tempfile import TemporaryDirectory

from translation.thot.thot_model_trainer_helper import get_emtpy_parallel_corpus, get_parallel_corpus

from machine.corpora.parallel_text_corpus import ParallelTextCorpus
from machine.tokenization import StringTokenizer, WhitespaceTokenizer
from machine.translation.symmetrized_word_alignment_model_trainer import SymmetrizedWordAlignmentModelTrainer
from machine.translation.thot import ThotWordAlignmentModelTrainer
from machine.translation.thot.thot_symmetrized_word_alignment_model import ThotSymmetrizedWordAlignmentModel
from machine.translation.thot.thot_word_alignment_model_utils import create_thot_word_alignment_model
from machine.translation.word_alignment_matrix import WordAlignmentMatrix
from tests.translation.thot.thot_model_trainer_helper import get_emtpy_parallel_corpus, get_parallel_corpus


def train_model(
Expand Down

0 comments on commit 186527d

Please sign in to comment.