``load_cached`` returns the same absolute-path shape that a fresh extraction produces, so consumers don't need to special-case cache hits vs. fresh extraction.
(tmp_path)
| 277 | |
| 278 | |
| 279 | def test_load_cached_absolutizes_source_file(tmp_path): |
| 280 | """``load_cached`` returns the same absolute-path shape that a fresh |
| 281 | extraction produces, so consumers don't need to special-case cache |
| 282 | hits vs. fresh extraction.""" |
| 283 | from graphify.cache import save_cached, load_cached |
| 284 | |
| 285 | (tmp_path / "src").mkdir() |
| 286 | src = tmp_path / "src" / "foo.py" |
| 287 | src.write_text("def x(): pass\n") |
| 288 | abs_src = str(src.resolve()) |
| 289 | save_cached(src, { |
| 290 | "nodes": [{"id": "n1", "source_file": abs_src}], |
| 291 | "edges": [{"source": "n1", "target": "n1", "source_file": abs_src}], |
| 292 | }, root=tmp_path, kind="ast") |
| 293 | |
| 294 | loaded = load_cached(src, root=tmp_path, kind="ast") |
| 295 | assert loaded is not None |
| 296 | assert loaded["nodes"][0]["source_file"] == abs_src |
| 297 | assert loaded["edges"][0]["source_file"] == abs_src |
| 298 | |
| 299 | |
| 300 | def test_load_cached_passes_through_legacy_absolute_source_file(tmp_path): |
nothing calls this directly
no test coverage detected