From 4eb2bc418066a61dd9534109da9e3616a65c40b7 Mon Sep 17 00:00:00 2001 From: chbndrhnns Date: Fri, 8 Sep 2023 18:21:40 +0200 Subject: [PATCH] Use Optional --- tests/test_pydantic_v1_models.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_pydantic_v1_models.py b/tests/test_pydantic_v1_models.py index a719ee4b4..36bbcf146 100644 --- a/tests/test_pydantic_v1_models.py +++ b/tests/test_pydantic_v1_models.py @@ -1,3 +1,5 @@ +from typing import Optional + import pytest from fastapi import Body, FastAPI from fastapi._compat import PYDANTIC_V2 @@ -12,9 +14,9 @@ if PYDANTIC_V2: class Item(v1.BaseModel): name: str - description: str | None = None + description: Optional[str] = None price: float - tax: float | None = None + tax: Optional[float] = None tags: list = [] class Model(v1.BaseModel): @@ -25,9 +27,9 @@ else: class Item(BaseModel): name: str - description: str | None = None + description: Optional[str] = None price: float - tax: float | None = None + tax: Optional[float] = None tags: list = [] class Model(BaseModel):