diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py index 8a7728edd..b5e132f0e 100644 --- a/fastapi/dependencies/utils.py +++ b/fastapi/dependencies/utils.py @@ -1,8 +1,8 @@ import inspect +import types from contextlib import AsyncExitStack, contextmanager from copy import copy, deepcopy from dataclasses import dataclass -import types from typing import ( Any, Callable, diff --git a/tests/test_none_passed_when_null_received.py b/tests/test_none_passed_when_null_received.py index 883ba9518..f4e171202 100644 --- a/tests/test_none_passed_when_null_received.py +++ b/tests/test_none_passed_when_null_received.py @@ -1,8 +1,8 @@ -from typing import Optional, Union, Annotated +from typing import Annotated, Optional, Union -from fastapi import FastAPI, Body -from fastapi.testclient import TestClient import pytest +from fastapi import Body, FastAPI +from fastapi.testclient import TestClient app = FastAPI() DEFAULT = 1234567890 @@ -20,7 +20,7 @@ def api2(integer_or_null: Annotated[Optional[int], Body(embed=True)] = DEFAULT) @app.post("/api3") def api3( - integer_or_null: Annotated[Union[int, None], Body(embed=True)] = DEFAULT + integer_or_null: Annotated[Union[int, None], Body(embed=True)] = DEFAULT, ) -> dict: return {"received": integer_or_null}