from_path returns the cached index directly when get_validated_cache hits.
(tmp_project: Path)
| 235 | |
| 236 | |
| 237 | def test_from_path_uses_cache_when_valid(tmp_project: Path) -> None: |
| 238 | """from_path returns the cached index directly when get_validated_cache hits.""" |
| 239 | fake_cached = MagicMock(spec=SembleIndex) |
| 240 | with patch("semble.index.index.get_validated_cache", return_value=tmp_project / "cache"): |
| 241 | with patch.object(SembleIndex, "load_from_disk", return_value=fake_cached): |
| 242 | result = SembleIndex.from_path(tmp_project) |
| 243 | assert result is fake_cached |
| 244 | |
| 245 | |
| 246 | @pytest.mark.parametrize("ref", [None, "v1.0"]) |