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

Method test_multi_file_force_pyi

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

Source from the content-addressed store, hash-verified

1145
1146 @event_loop()
1147 def test_multi_file_force_pyi(self) -> None:
1148 reg_mode = DEFAULT_MODE
1149 pyi_mode = replace(DEFAULT_MODE, is_pyi=True)
1150 contents, expected = read_data("miscellaneous", "force_pyi")
1151 with cache_dir() as workspace:
1152 paths = [
1153 (workspace / "file1.py").resolve(),
1154 (workspace / "file2.py").resolve(),
1155 ]
1156 for path in paths:
1157 path.write_text(contents, encoding="utf-8")
1158 self.invokeBlack([str(p) for p in paths] + ["--pyi"])
1159 for path in paths:
1160 actual = path.read_text(encoding="utf-8")
1161 self.assertEqual(actual, expected)
1162 # verify cache with --pyi is separate
1163 pyi_cache = black.Cache.read(pyi_mode)
1164 normal_cache = black.Cache.read(reg_mode)
1165 for path in paths:
1166 assert not pyi_cache.is_changed(path)
1167 assert normal_cache.is_changed(path)
1168
1169 def test_pipe_force_pyi(self) -> None:
1170 source, expected = read_data("miscellaneous", "force_pyi")

Callers

nothing calls this directly

Calls 5

read_dataFunction · 0.90
replaceFunction · 0.85
cache_dirFunction · 0.85
readMethod · 0.80
is_changedMethod · 0.80

Tested by

no test coverage detected