from_path raises FileNotFoundError for missing paths and NotADirectoryError for files.
(
mock_model: Any, tmp_path: Path, kind: str, expected_exc: type[Exception]
)
| 66 | [("missing", FileNotFoundError), ("file", NotADirectoryError)], |
| 67 | ) |
| 68 | def test_from_path_rejects_invalid_paths( |
| 69 | mock_model: Any, tmp_path: Path, kind: str, expected_exc: type[Exception] |
| 70 | ) -> None: |
| 71 | """from_path raises FileNotFoundError for missing paths and NotADirectoryError for files.""" |
| 72 | if kind == "missing": |
| 73 | target = tmp_path / "does_not_exist" |
| 74 | else: |
| 75 | target = tmp_path / "not_a_dir.py" |
| 76 | target.write_text("x = 1\n") |
| 77 | with patch("semble.index.index.load_model", return_value=(mock_model, "")): |
| 78 | with pytest.raises(expected_exc): |
| 79 | SembleIndex.from_path(target) |
| 80 | |
| 81 | |
| 82 | def test_from_git_raises_on_failure(mock_model: Any) -> None: |