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

Method test_cache_multiple_files

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

Source from the content-addressed store, hash-verified

2242
2243 @event_loop()
2244 def test_cache_multiple_files(self) -> None:
2245 mode = DEFAULT_MODE
2246 with (
2247 cache_dir() as workspace,
2248 patch("concurrent.futures.ProcessPoolExecutor", new=ThreadPoolExecutor),
2249 ):
2250 one = (workspace / "one.py").resolve()
2251 one.write_text("print('hello')", encoding="utf-8")
2252 two = (workspace / "two.py").resolve()
2253 two.write_text("print('hello')", encoding="utf-8")
2254 cache = black.Cache.read(mode)
2255 cache.write([one])
2256 invokeBlack([str(workspace)])
2257 assert one.read_text(encoding="utf-8") == "print('hello')"
2258 assert two.read_text(encoding="utf-8") == 'print("hello")\n'
2259 cache = black.Cache.read(mode)
2260 assert not cache.is_changed(one)
2261 assert not cache.is_changed(two)
2262
2263 @pytest.mark.incompatible_with_mypyc
2264 @pytest.mark.parametrize("color", [False, True], ids=["no-color", "with-color"])

Callers

nothing calls this directly

Calls 5

cache_dirFunction · 0.85
invokeBlackFunction · 0.85
readMethod · 0.80
writeMethod · 0.80
is_changedMethod · 0.80

Tested by

no test coverage detected