diff --git a/tests/test_categorizer.py b/tests/test_categorizer.py new file mode 100644 index 00000000..7b10b9b5 --- /dev/null +++ b/tests/test_categorizer.py @@ -0,0 +1,38 @@ +from pathlib import Path +import pytest +from categorizer import FixtureClass, Speed, auto_classify + +def _write(tmp_path: Path, name: str, content: str) -> Path: + p = tmp_path / name + p.write_text(content, encoding="utf-8") + return p + +def test_auto_classify_clean_install_filename(tmp_path: Path) -> None: + p = _write(tmp_path, "test_clean_install.py", "def test_x(): pass\n") + r = auto_classify(p) + assert r.fixture_class == FixtureClass.OPT_IN + +def test_auto_classify_docker_build_filename(tmp_path: Path) -> None: + p = _write(tmp_path, "test_docker_build.py", "def test_x(): pass\n") + r = auto_classify(p) + assert r.fixture_class == FixtureClass.OPT_IN + +def test_auto_classify_live_gui_fixture_in_source(tmp_path: Path) -> None: + p = _write(tmp_path, "test_x.py", "def test_x(live_gui): pass\n") + r = auto_classify(p) + assert r.fixture_class == FixtureClass.LIVE_GUI + +def test_auto_classify_mock_app_fixture_in_source(tmp_path: Path) -> None: + p = _write(tmp_path, "test_x.py", "def test_x(mock_app): pass\n") + r = auto_classify(p) + assert r.fixture_class == FixtureClass.MOCK_APP + +def test_auto_classify_perf_keyword_in_filename(tmp_path: Path) -> None: + p = _write(tmp_path, "test_xyz_stress.py", "def test_x(): pass\n") + r = auto_classify(p) + assert r.fixture_class == FixtureClass.PERFORMANCE + +def test_auto_classify_default_to_unit(tmp_path: Path) -> None: + p = _write(tmp_path, "test_command_palette.py", "def test_x(): pass\n") + r = auto_classify(p) + assert r.fixture_class == FixtureClass.UNIT