Download tests/test_test_selector.py from tailot/codex-python: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/datasets/tailot/codex-python/resolve/2a9dc4c69bfc53221796fe110a453ea89e95ae78/tests/test_test_selector.py
- Command line
-
hf download hf://datasets/tailot/codex-python@2a9dc4c69bfc53221796fe110a453ea89e95ae78/tests/test_test_selector.py
-
curl -L -o test_test_selector.py https://huggingface.co/datasets/tailot/codex-python/resolve/2a9dc4c69bfc53221796fe110a453ea89e95ae78/tests/test_test_selector.py
1.31 kB
| """Tests for import-aware Python test selection.""" | |
| from __future__ import annotations | |
| from pathlib import Path | |
| from lingologos_python.test_selector import discover_test_files, is_test_file, select_python_tests | |
| def test_is_test_file_conventions() -> None: | |
| assert is_test_file("tests/test_alpha.py") | |
| assert is_test_file("pkg/alpha_test.py") | |
| assert not is_test_file("src/alpha.py") | |
| def test_discover_test_files_prefers_tests_dir(sample_pkg: Path) -> None: | |
| found = discover_test_files(sample_pkg) | |
| assert found == ["tests/test_mathops.py", "tests/test_textops.py"] | |
| def test_select_python_tests_follows_cross_file_imports(sample_pkg: Path) -> None: | |
| selected_math = select_python_tests(sample_pkg, ["src/mathops.py"]) | |
| assert selected_math == ["tests/test_mathops.py", "tests/test_textops.py"] | |
| selected_text = select_python_tests(sample_pkg, ["src/textops.py"]) | |
| assert selected_text == ["tests/test_textops.py"] | |
| def test_select_python_tests_returns_self_when_test_file_changed(sample_pkg: Path) -> None: | |
| assert select_python_tests(sample_pkg, ["tests/test_textops.py"]) == ["tests/test_textops.py"] | |
| def test_select_python_tests_returns_empty_for_unknown_file(sample_pkg: Path) -> None: | |
| assert select_python_tests(sample_pkg, ["src/unrelated_missing.py"]) == [] | |