From: Mohammed Date: Sat, 23 Mar 2019 10:10:45 +0000 (+0300) Subject: files formatting X-Git-Tag: 0.12.0~3^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eda9b28338c79bfd28f008507fe92599ec2ea815;p=thirdparty%2Ffastapi%2Ffastapi.git files formatting --- diff --git a/fastapi/routing.py b/fastapi/routing.py index 2f53e0b08c..9dfd316aba 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -148,9 +148,11 @@ class APIRoute(routing.Route): existed_codes.append(add_response.status_code) response_models: List[Any] = [m for m in add_response.models] schema_field = None - if add_response.content_type == "application/json" or lenient_issubclass( - content_type, JSONResponse - ) and len(response_models): + if ( + add_response.content_type == "application/json" + or lenient_issubclass(content_type, JSONResponse) + and len(response_models) + ): schema_field = Field( name=f"Additional_response_{add_response.status_code}", type_=Union[tuple(response_models)], diff --git a/tests/test_additional_responses.py b/tests/test_additional_responses.py index aa150b5381..fa46d3ccbb 100644 --- a/tests/test_additional_responses.py +++ b/tests/test_additional_responses.py @@ -2,7 +2,6 @@ import pytest from fastapi import FastAPI from fastapi.openapi.models import AdditionalResponse from pydantic import BaseModel -from pydantic.error_wrappers import ValidationError from starlette.responses import JSONResponse from starlette.testclient import TestClient