self.assertEqual(err_lines[-1], "error: cannot format e1: boom")
self.assertEqual(
unstyle(str(report)),
- "1 file reformatted, 2 files left unchanged, 1 file failed to"
- " reformat.",
+ (
+ "1 file reformatted, 2 files left unchanged, 1 file failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.done(Path("f3"), black.Changed.YES)
self.assertEqual(out_lines[-1], "reformatted f3")
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 2 files left unchanged, 1 file failed to"
- " reformat.",
+ (
+ "2 files reformatted, 2 files left unchanged, 1 file failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.failed(Path("e2"), "boom")
self.assertEqual(err_lines[-1], "error: cannot format e2: boom")
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 2 files left unchanged, 2 files failed to"
- " reformat.",
+ (
+ "2 files reformatted, 2 files left unchanged, 2 files failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.path_ignored(Path("wat"), "no match")
self.assertEqual(out_lines[-1], "wat ignored: no match")
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 2 files left unchanged, 2 files failed to"
- " reformat.",
+ (
+ "2 files reformatted, 2 files left unchanged, 2 files failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.done(Path("f4"), black.Changed.NO)
self.assertEqual(out_lines[-1], "f4 already well formatted, good job.")
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 3 files left unchanged, 2 files failed to"
- " reformat.",
+ (
+ "2 files reformatted, 3 files left unchanged, 2 files failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.check = True
self.assertEqual(
unstyle(str(report)),
- "2 files would be reformatted, 3 files would be left unchanged, 2"
- " files would fail to reformat.",
+ (
+ "2 files would be reformatted, 3 files would be left unchanged, 2"
+ " files would fail to reformat."
+ ),
)
report.check = False
report.diff = True
self.assertEqual(
unstyle(str(report)),
- "2 files would be reformatted, 3 files would be left unchanged, 2"
- " files would fail to reformat.",
+ (
+ "2 files would be reformatted, 3 files would be left unchanged, 2"
+ " files would fail to reformat."
+ ),
)
def test_report_quiet(self) -> None:
self.assertEqual(err_lines[-1], "error: cannot format e1: boom")
self.assertEqual(
unstyle(str(report)),
- "1 file reformatted, 2 files left unchanged, 1 file failed to"
- " reformat.",
+ (
+ "1 file reformatted, 2 files left unchanged, 1 file failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.done(Path("f3"), black.Changed.YES)
self.assertEqual(len(err_lines), 1)
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 2 files left unchanged, 1 file failed to"
- " reformat.",
+ (
+ "2 files reformatted, 2 files left unchanged, 1 file failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.failed(Path("e2"), "boom")
self.assertEqual(err_lines[-1], "error: cannot format e2: boom")
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 2 files left unchanged, 2 files failed to"
- " reformat.",
+ (
+ "2 files reformatted, 2 files left unchanged, 2 files failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.path_ignored(Path("wat"), "no match")
self.assertEqual(len(err_lines), 2)
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 2 files left unchanged, 2 files failed to"
- " reformat.",
+ (
+ "2 files reformatted, 2 files left unchanged, 2 files failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.done(Path("f4"), black.Changed.NO)
self.assertEqual(len(err_lines), 2)
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 3 files left unchanged, 2 files failed to"
- " reformat.",
+ (
+ "2 files reformatted, 3 files left unchanged, 2 files failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.check = True
self.assertEqual(
unstyle(str(report)),
- "2 files would be reformatted, 3 files would be left unchanged, 2"
- " files would fail to reformat.",
+ (
+ "2 files would be reformatted, 3 files would be left unchanged, 2"
+ " files would fail to reformat."
+ ),
)
report.check = False
report.diff = True
self.assertEqual(
unstyle(str(report)),
- "2 files would be reformatted, 3 files would be left unchanged, 2"
- " files would fail to reformat.",
+ (
+ "2 files would be reformatted, 3 files would be left unchanged, 2"
+ " files would fail to reformat."
+ ),
)
def test_report_normal(self) -> None:
self.assertEqual(err_lines[-1], "error: cannot format e1: boom")
self.assertEqual(
unstyle(str(report)),
- "1 file reformatted, 2 files left unchanged, 1 file failed to"
- " reformat.",
+ (
+ "1 file reformatted, 2 files left unchanged, 1 file failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.done(Path("f3"), black.Changed.YES)
self.assertEqual(out_lines[-1], "reformatted f3")
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 2 files left unchanged, 1 file failed to"
- " reformat.",
+ (
+ "2 files reformatted, 2 files left unchanged, 1 file failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.failed(Path("e2"), "boom")
self.assertEqual(err_lines[-1], "error: cannot format e2: boom")
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 2 files left unchanged, 2 files failed to"
- " reformat.",
+ (
+ "2 files reformatted, 2 files left unchanged, 2 files failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.path_ignored(Path("wat"), "no match")
self.assertEqual(len(err_lines), 2)
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 2 files left unchanged, 2 files failed to"
- " reformat.",
+ (
+ "2 files reformatted, 2 files left unchanged, 2 files failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.done(Path("f4"), black.Changed.NO)
self.assertEqual(len(err_lines), 2)
self.assertEqual(
unstyle(str(report)),
- "2 files reformatted, 3 files left unchanged, 2 files failed to"
- " reformat.",
+ (
+ "2 files reformatted, 3 files left unchanged, 2 files failed to"
+ " reformat."
+ ),
)
self.assertEqual(report.return_code, 123)
report.check = True
self.assertEqual(
unstyle(str(report)),
- "2 files would be reformatted, 3 files would be left unchanged, 2"
- " files would fail to reformat.",
+ (
+ "2 files would be reformatted, 3 files would be left unchanged, 2"
+ " files would fail to reformat."
+ ),
)
report.check = False
report.diff = True
self.assertEqual(
unstyle(str(report)),
- "2 files would be reformatted, 3 files would be left unchanged, 2"
- " files would fail to reformat.",
+ (
+ "2 files would be reformatted, 3 files would be left unchanged, 2"
+ " files would fail to reformat."
+ ),
)
def test_lib2to3_parse(self) -> None: