MCPcopy Index your code
hub / github.com/SourceCode-AI/aura / test_pypi_cache

Function test_pypi_cache

tests/test_cache.py:254–272  ·  view source on GitHub ↗
(pkg_list_mock, mock_cache)

Source from the content-addressed store, hash-verified

252
253@mock.patch("aura.cache.PyPIPackageList._get_package_list")
254def test_pypi_cache(pkg_list_mock, mock_cache):
255 pkgs = ["pkg1", "pkg2", "pkg3"]
256 pkg_list_mock.return_value = pkgs
257
258 output = cache.PyPIPackageList.proxy()
259 assert output == pkgs
260 assert pkg_list_mock.called is True
261 pkg_list_mock.reset_mock()
262
263 output = cache.PyPIPackageList.proxy()
264 assert output == pkgs
265 assert pkg_list_mock.called is False
266
267 cache_items = tuple(cache.CacheItem.iter_items())
268 assert len(cache_items) == 1
269 assert cache_items[0].metadata["type"] == "pypi_package_list"
270
271 cache.CacheItem.cleanup()
272 assert len(tuple(cache.CacheItem.iter_items())) == 0
273
274
275@mock.patch("aura.cache.ASTPatternCache.get_patterns_hash", return_value="sig1")

Callers

nothing calls this directly

Calls 3

iter_itemsMethod · 0.80
proxyMethod · 0.45
cleanupMethod · 0.45

Tested by

no test coverage detected