X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/a02829bea1452e0db150eec88c2d99eaf162aa72..7a14a37981862ef418f3cdb4a7e2375856f97529:/tests/test_black.py?ds=inline diff --git a/tests/test_black.py b/tests/test_black.py index 66aa360..7a4a3bb 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -598,6 +598,16 @@ class BlackTestCase(unittest.TestCase): # but not on 3.6, because we use async as a reserved keyword self.invokeBlack([str(source_path), "--target-version", "py36"], exit_code=123) + @patch("black.dump_to_file", dump_to_stderr) + def test_python38(self) -> None: + source, expected = read_data("python38") + actual = fs(source) + self.assertFormatEqual(expected, actual) + major, minor = sys.version_info[:2] + if major > 3 or (major == 3 and minor >= 8): + black.assert_equivalent(source, actual) + black.assert_stable(source, actual, black.FileMode()) + @patch("black.dump_to_file", dump_to_stderr) def test_fmtonoff(self) -> None: source, expected = read_data("fmtonoff") @@ -1635,6 +1645,16 @@ class BlackTestCase(unittest.TestCase): raise result.exception self.assertEqual(result.exit_code, 0) + def test_invalid_config_return_code(self) -> None: + tmp_file = Path(black.dump_to_file()) + try: + tmp_config = Path(black.dump_to_file()) + tmp_config.unlink() + args = ["--config", str(tmp_config), str(tmp_file)] + self.invokeBlack(args, exit_code=2, ignore_config=False) + finally: + tmp_file.unlink() + class BlackDTestCase(AioHTTPTestCase): async def get_application(self) -> web.Application: