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

Method test_single_file_force_pyi

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

Source from the content-addressed store, hash-verified

1127 self.invokeBlack([str(workspace.resolve())])
1128
1129 def test_single_file_force_pyi(self) -> None:
1130 pyi_mode = replace(DEFAULT_MODE, is_pyi=True)
1131 contents, expected = read_data("miscellaneous", "force_pyi")
1132 with cache_dir() as workspace:
1133 path = (workspace / "file.py").resolve()
1134 path.write_text(contents, encoding="utf-8")
1135 self.invokeBlack([str(path), "--pyi"])
1136 actual = path.read_text(encoding="utf-8")
1137 # verify cache with --pyi is separate
1138 pyi_cache = black.Cache.read(pyi_mode)
1139 assert not pyi_cache.is_changed(path)
1140 normal_cache = black.Cache.read(DEFAULT_MODE)
1141 assert normal_cache.is_changed(path)
1142 self.assertFormatEqual(expected, actual)
1143 black.assert_equivalent(contents, actual)
1144 black.assert_stable(contents, actual, pyi_mode)
1145
1146 @event_loop()
1147 def test_multi_file_force_pyi(self) -> None:

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected