From: Ɓukasz Langa Date: Fri, 16 Mar 2018 00:05:59 +0000 (-0700) Subject: Fix tests after introducing --check X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/c85cb48ec2cfdee2e742b59855e38431ff8ed46a?ds=sidebyside Fix tests after introducing --check --- diff --git a/tests/test_black.py b/tests/test_black.py index d9c0c5e..223c907 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -160,30 +160,30 @@ class BlackTestCase(unittest.TestCase): err_lines.append(msg) with patch("black.out", out), patch("black.err", err): - report.done(Path('f1'), changed=True) + report.done(Path('f1'), changed=False) self.assertEqual(len(out_lines), 1) self.assertEqual(len(err_lines), 0) - self.assertEqual(out_lines[-1], 'reformatted f1') - self.assertEqual(unstyle(str(report)), '1 file reformatted.') + self.assertEqual(out_lines[-1], 'f1 already well formatted, good job.') + self.assertEqual(unstyle(str(report)), '1 file left unchanged.') self.assertEqual(report.return_code, 0) - report.failed(Path('e1'), 'boom') - self.assertEqual(len(out_lines), 1) - self.assertEqual(len(err_lines), 1) - self.assertEqual(err_lines[-1], 'error: cannot format e1: boom') + report.done(Path('f2'), changed=True) + self.assertEqual(len(out_lines), 2) + self.assertEqual(len(err_lines), 0) + self.assertEqual(out_lines[-1], 'reformatted f2') self.assertEqual( - unstyle(str(report)), '1 file reformatted, 1 file failed to reformat.' + unstyle(str(report)), '1 file reformatted, 1 file left unchanged.' ) self.assertEqual(report.return_code, 1) - report.done(Path('f2'), changed=False) + report.failed(Path('e1'), 'boom') self.assertEqual(len(out_lines), 2) self.assertEqual(len(err_lines), 1) - self.assertEqual(out_lines[-1], 'f2 already well formatted, good job.') + self.assertEqual(err_lines[-1], 'error: cannot format e1: boom') self.assertEqual( unstyle(str(report)), '1 file reformatted, 1 file left unchanged, ' '1 file failed to reformat.', ) - self.assertEqual(report.return_code, 1) + self.assertEqual(report.return_code, 123) report.done(Path('f3'), changed=True) self.assertEqual(len(out_lines), 3) self.assertEqual(len(err_lines), 1) @@ -193,7 +193,7 @@ class BlackTestCase(unittest.TestCase): '2 files reformatted, 1 file left unchanged, ' '1 file failed to reformat.', ) - self.assertEqual(report.return_code, 1) + self.assertEqual(report.return_code, 123) report.failed(Path('e2'), 'boom') self.assertEqual(len(out_lines), 3) self.assertEqual(len(err_lines), 2) @@ -203,7 +203,7 @@ class BlackTestCase(unittest.TestCase): '2 files reformatted, 1 file left unchanged, ' '2 files failed to reformat.', ) - self.assertEqual(report.return_code, 1) + self.assertEqual(report.return_code, 123) report.done(Path('f4'), changed=False) self.assertEqual(len(out_lines), 4) self.assertEqual(len(err_lines), 2) @@ -213,7 +213,7 @@ class BlackTestCase(unittest.TestCase): '2 files reformatted, 2 files left unchanged, ' '2 files failed to reformat.', ) - self.assertEqual(report.return_code, 1) + self.assertEqual(report.return_code, 123) if __name__ == '__main__':