(self)
| 376 | black.assert_stable(source, not_normalized, mode=mode) |
| 377 | |
| 378 | def test_skip_source_first_line(self) -> None: |
| 379 | source, _ = read_data("miscellaneous", "invalid_header") |
| 380 | tmp_file = Path(black.dump_to_file(source)) |
| 381 | # Full source should fail (invalid syntax at header) |
| 382 | self.invokeBlack([str(tmp_file), "--diff", "--check"], exit_code=123) |
| 383 | # So, skipping the first line should work |
| 384 | result = BlackRunner().invoke( |
| 385 | black.main, [str(tmp_file), "-x", f"--config={EMPTY_CONFIG}"] |
| 386 | ) |
| 387 | self.assertEqual(result.exit_code, 0) |
| 388 | actual = tmp_file.read_text(encoding="utf-8") |
| 389 | self.assertFormatEqual(source, actual) |
| 390 | |
| 391 | def test_skip_source_first_line_when_mixing_newlines(self) -> None: |
| 392 | code_mixing_newlines = b"Header will be skipped\r\ni = [1,2,3]\nj = [1,2,3]\n" |
nothing calls this directly
no test coverage detected