X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/bbc09a4f013f2a584f143f3f5e3f76f6082367d4..7fc6ce990669464f5172b63fafa3724f5f308be3:/tests/test_black.py diff --git a/tests/test_black.py b/tests/test_black.py index f6952c7..e98f019 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -100,6 +100,25 @@ class BlackTestCase(unittest.TestCase): black.err(str(ve)) self.assertEqual(expected, actual) + @patch("black.dump_to_file", dump_to_stderr) + def test_empty(self) -> None: + source = expected = "" + actual = fs(source) + self.assertFormatEqual(expected, actual) + black.assert_equivalent(source, actual) + black.assert_stable(source, actual, line_length=ll) + + def test_empty_ff(self) -> None: + expected = "" + tmp_file = Path(black.dump_to_file()) + try: + self.assertFalse(ff(tmp_file, write_back=black.WriteBack.YES)) + with open(tmp_file, encoding="utf8") as f: + actual = f.read() + finally: + os.unlink(tmp_file) + self.assertFormatEqual(expected, actual) + @patch("black.dump_to_file", dump_to_stderr) def test_self(self) -> None: source, expected = read_data("test_black")