X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0359b85b5800dd77f8f1cfaa88ca8ab8215df685..2fd9d8b339e1e2e1b93956c6d68b2b358b3fc29d:/tests/test_blackd.py diff --git a/tests/test_blackd.py b/tests/test_blackd.py index db9a165..5b6461f 100644 --- a/tests/test_blackd.py +++ b/tests/test_blackd.py @@ -177,6 +177,20 @@ class BlackDTestCase(AioHTTPTestCase): # type: ignore[misc] ) self.assertEqual(response.status, 400) + @unittest_run_loop + async def test_blackd_skip_first_source_line(self) -> None: + invalid_first_line = b"Header will be skipped\r\ni = [1,2,3]\nj = [1,2,3]\n" + expected_result = b"Header will be skipped\r\ni = [1, 2, 3]\nj = [1, 2, 3]\n" + response = await self.client.post("/", data=invalid_first_line) + self.assertEqual(response.status, 400) + response = await self.client.post( + "/", + data=invalid_first_line, + headers={blackd.SKIP_SOURCE_FIRST_LINE: "true"}, + ) + self.assertEqual(response.status, 200) + self.assertEqual(await response.read(), expected_result) + @unittest_run_loop async def test_blackd_preview(self) -> None: response = await self.client.post(