MCPcopy
hub / github.com/psf/black / test_cache_broken_file

Method test_cache_broken_file

tests/test_black.py:2221–2231  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2219 assert "../../../tmp/pwned" not in mode.get_cache_key()
2220
2221 def test_cache_broken_file(self) -> None:
2222 mode = DEFAULT_MODE
2223 with cache_dir() as workspace:
2224 cache_file = get_cache_file(mode)
2225 cache_file.write_text("this is not a pickle", encoding="utf-8")
2226 assert black.Cache.read(mode).file_data == {}
2227 src = (workspace / "test.py").resolve()
2228 src.write_text("print('hello')", encoding="utf-8")
2229 invokeBlack([str(src)])
2230 cache = black.Cache.read(mode)
2231 assert not cache.is_changed(src)
2232
2233 def test_cache_single_file_already_cached(self) -> None:
2234 mode = DEFAULT_MODE

Callers

nothing calls this directly

Calls 5

get_cache_fileFunction · 0.90
cache_dirFunction · 0.85
invokeBlackFunction · 0.85
readMethod · 0.80
is_changedMethod · 0.80

Tested by

no test coverage detected