Skip to content

Commit

Permalink
!squash
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Jun 18, 2023
1 parent e3c740f commit 17a8e33
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
16 changes: 7 additions & 9 deletions tests/conftest.py
Expand Up @@ -9,9 +9,7 @@

from cihai.data.unihan.constants import UNIHAN_FILES


if t.TYPE_CHECKING:
from .types import UnihanOptions
from unihan_etl.options import Options as UnihanOptions


@pytest.fixture
Expand Down Expand Up @@ -49,12 +47,12 @@ def zip_file(zip_path: pathlib.Path, fixture_path: pathlib.Path) -> zipfile.ZipF
@pytest.fixture
def unihan_options(
zip_file: zipfile.ZipFile, zip_path: pathlib.Path, tmp_path: pathlib.Path
) -> "UnihanOptions":
return {
"source": zip_path,
"work_dir": tmp_path,
"zip_path": tmp_path / "downloads" / "Moo.zip",
}
) -> UnihanOptions:
return UnihanOptions(
source=str(zip_path),
work_dir=tmp_path,
zip_path=tmp_path / "downloads" / "Moo.zip",
)


@pytest.fixture(scope="function")
Expand Down
10 changes: 7 additions & 3 deletions tests/test_cihai.py
Expand Up @@ -5,6 +5,7 @@
"""
import dataclasses
import pathlib
import typing as t
import sqlalchemy

Expand All @@ -13,6 +14,9 @@
from cihai.core import Cihai
from cihai.data.unihan import bootstrap, constants as unihan_constants

if t.TYPE_CHECKING:
from unihan_etl.options import Options as UnihanOptions


def test_cihai_version() -> None:
assert cihai.__version__
Expand All @@ -38,16 +42,16 @@ def test_config_dict_args() -> None:
assert result == expected


def test_yaml_config_and_override(test_config_file: str) -> None:
def test_yaml_config_and_override(test_config_file: pathlib.Path) -> None:
app = Cihai.from_file(test_config_file)

assert hasattr(app.config, "database")


def test_unihan_options(
unihan_options: t.Dict[str, object],
unihan_options: "UnihanOptions",
engine: sqlalchemy.Engine,
test_config_file: str,
test_config_file: pathlib.Path,
) -> None:
app = Cihai.from_file(test_config_file)
bootstrap.bootstrap_unihan(
Expand Down

0 comments on commit 17a8e33

Please sign in to comment.