X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/92957a41e3f909c7b813b448f65cd437cf0139f2..2d9eaafa97e967c8974a6321dcc442a90192140f:/tests/test_black.py?ds=inline diff --git a/tests/test_black.py b/tests/test_black.py index 94cbe35..5e17faf 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -229,6 +229,14 @@ class BlackTestCase(unittest.TestCase): black.assert_equivalent(source, actual) black.assert_stable(source, actual, line_length=ll) + @patch("black.dump_to_file", dump_to_stderr) + def test_slices(self) -> None: + source, expected = read_data("slices") + actual = fs(source) + self.assertFormatEqual(expected, actual) + black.assert_equivalent(source, actual) + black.assert_stable(source, actual, line_length=ll) + @patch("black.dump_to_file", dump_to_stderr) def test_comments(self) -> None: source, expected = read_data("comments") @@ -628,6 +636,12 @@ class BlackTestCase(unittest.TestCase): ) self.assertEqual(result.exit_code, 1) + def test_no_files(self) -> None: + with cache_dir(): + # Without an argument, black exits with error code 0. + result = CliRunner().invoke(black.main, []) + self.assertEqual(result.exit_code, 0) + def test_read_cache_line_lengths(self) -> None: with cache_dir() as workspace: path = (workspace / "file.py").resolve()