MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / test_load_cached_absolutizes_source_file

Function test_load_cached_absolutizes_source_file

tests/test_cache.py:279–297  ·  view source on GitHub ↗

``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)

Source from the content-addressed store, hash-verified

277
278
279def 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
300def test_load_cached_passes_through_legacy_absolute_source_file(tmp_path):

Callers

nothing calls this directly

Calls 3

save_cachedFunction · 0.90
load_cachedFunction · 0.90
resolveMethod · 0.45

Tested by

no test coverage detected