- @async_test
- async def test_blackd_py36(self) -> None:
- app = blackd.make_app()
- async with TestClient(TestServer(app)) as client:
- response = await client.post(
- "/",
- data=(
- "def f(\n"
- " and_has_a_bunch_of,\n"
- " very_long_arguments_too,\n"
- " and_lots_of_them_as_well_lol,\n"
- " **and_very_long_keyword_arguments\n"
- "):\n"
- " pass\n"
- ),
- headers={blackd.PYTHON_VARIANT_HEADER: "3.6"},
- )
- self.assertEqual(response.status, 200)
- response = await client.post(
- "/",
- data=(
- "def f(\n"
- " and_has_a_bunch_of,\n"
- " very_long_arguments_too,\n"
- " and_lots_of_them_as_well_lol,\n"
- " **and_very_long_keyword_arguments\n"
- "):\n"
- " pass\n"
- ),
- headers={blackd.PYTHON_VARIANT_HEADER: "3.5"},
- )
- self.assertEqual(response.status, 204)
- response = await client.post(
- "/",
- data=(
- "def f(\n"
- " and_has_a_bunch_of,\n"
- " very_long_arguments_too,\n"
- " and_lots_of_them_as_well_lol,\n"
- " **and_very_long_keyword_arguments\n"
- "):\n"
- " pass\n"
- ),
- headers={blackd.PYTHON_VARIANT_HEADER: "2"},
- )
- self.assertEqual(response.status, 204)
+ @unittest_run_loop
+ async def test_blackd_diff(self) -> None:
+ diff_header = re.compile(
+ rf"(In|Out)\t\d\d\d\d-\d\d-\d\d "
+ rf"\d\d:\d\d:\d\d\.\d\d\d\d\d\d \+\d\d\d\d"
+ )
+
+ source, _ = read_data("blackd_diff.py")
+ expected, _ = read_data("blackd_diff.diff")
+
+ response = await self.client.post(
+ "/", data=source, headers={blackd.DIFF_HEADER: "true"}
+ )
+ self.assertEqual(response.status, 200)