MCPcopy Index your code
hub / github.com/MinishLab/semble / test_from_path_rejects_invalid_paths

Function test_from_path_rejects_invalid_paths

tests/test_git.py:68–79  ·  view source on GitHub ↗

from_path raises FileNotFoundError for missing paths and NotADirectoryError for files.

(
    mock_model: Any, tmp_path: Path, kind: str, expected_exc: type[Exception]
)

Source from the content-addressed store, hash-verified

66 [("missing", FileNotFoundError), ("file", NotADirectoryError)],
67)
68def 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
82def test_from_git_raises_on_failure(mock_model: Any) -> None:

Callers

nothing calls this directly

Calls 1

from_pathMethod · 0.45

Tested by

no test coverage detected