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

Method test_single_file_force_py36

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

Source from the content-addressed store, hash-verified

1176 self.assertFormatEqual(actual, expected)
1177
1178 def test_single_file_force_py36(self) -> None:
1179 reg_mode = DEFAULT_MODE
1180 py36_mode = replace(DEFAULT_MODE, target_versions=PY36_VERSIONS)
1181 source, expected = read_data("miscellaneous", "force_py36")
1182 with cache_dir() as workspace:
1183 path = (workspace / "file.py").resolve()
1184 path.write_text(source, encoding="utf-8")
1185 self.invokeBlack([str(path), *PY36_ARGS])
1186 actual = path.read_text(encoding="utf-8")
1187 # verify cache with --target-version is separate
1188 py36_cache = black.Cache.read(py36_mode)
1189 assert not py36_cache.is_changed(path)
1190 normal_cache = black.Cache.read(reg_mode)
1191 assert normal_cache.is_changed(path)
1192 self.assertEqual(actual, expected)
1193
1194 @event_loop()
1195 def test_multi_file_force_py36(self) -> None:

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