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

Method test_multi_file_force_py36

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

Source from the content-addressed store, hash-verified

1193
1194 @event_loop()
1195 def test_multi_file_force_py36(self) -> None:
1196 reg_mode = DEFAULT_MODE
1197 py36_mode = replace(DEFAULT_MODE, target_versions=PY36_VERSIONS)
1198 source, expected = read_data("miscellaneous", "force_py36")
1199 with cache_dir() as workspace:
1200 paths = [
1201 (workspace / "file1.py").resolve(),
1202 (workspace / "file2.py").resolve(),
1203 ]
1204 for path in paths:
1205 path.write_text(source, encoding="utf-8")
1206 self.invokeBlack([str(p) for p in paths] + PY36_ARGS)
1207 for path in paths:
1208 actual = path.read_text(encoding="utf-8")
1209 self.assertEqual(actual, expected)
1210 # verify cache with --target-version is separate
1211 pyi_cache = black.Cache.read(py36_mode)
1212 normal_cache = black.Cache.read(reg_mode)
1213 for path in paths:
1214 assert not pyi_cache.is_changed(path)
1215 assert normal_cache.is_changed(path)
1216
1217 def test_pipe_force_py36(self) -> None:
1218 source, expected = read_data("miscellaneous", "force_py36")

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