Browse Source

Fix: Use typing_extensions.Annotated for Python 3.8 compatibility

Python 3.8 does not have Annotated in typing module (added in 3.9).
Using typing_extensions ensures tests run on all Python versions.

Added noqa: UP035 to suppress ruff's preference for typing module,
since typing_extensions is required for Python 3.8 support.
pull/14574/head
Adarsh Bennur 4 months ago
parent
commit
7a39d5b85f
  1. 3
      tests/test_forms_fields_set.py

3
tests/test_forms_fields_set.py

@ -6,12 +6,11 @@ This test validates that Form models correctly track which fields were
explicitly provided vs. which fields use defaults.
"""
from typing import Annotated
import pydantic
from fastapi import FastAPI, Form, Header, Query
from fastapi.testclient import TestClient
from pydantic import BaseModel
from typing_extensions import Annotated # noqa: UP035
PYDANTIC_V2 = int(pydantic.VERSION.split(".")[0]) >= 2

Loading…
Cancel
Save