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

Method test_one_empty_line_ff

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

Source from the content-addressed store, hash-verified

153 assert_format(source, expected)
154
155 def test_one_empty_line_ff(self) -> None:
156 for nl in ["\n", "\r\n"]:
157 expected = nl
158 tmp_file = Path(black.dump_to_file(nl))
159 if system() == "Windows":
160 # Writing files in text mode automatically uses the system newline,
161 # but in this case we don't want this for testing reasons. See:
162 # https://github.com/psf/black/pull/3348
163 with open(tmp_file, "wb") as f:
164 f.write(nl.encode("utf-8"))
165 try:
166 self.assertFalse(ff(tmp_file, write_back=black.WriteBack.YES))
167 with open(tmp_file, "rb") as f:
168 actual = f.read().decode("utf-8")
169 finally:
170 os.unlink(tmp_file)
171 self.assertFormatEqual(expected, actual)
172
173 def test_piping(self) -> None:
174 _, source, expected = read_data_from_file(

Callers

nothing calls this directly

Calls 3

writeMethod · 0.80
readMethod · 0.80
assertFormatEqualMethod · 0.80

Tested by

no test coverage detected