mirror of https://github.com/tiangolo/fastapi.git
Fix test ImportError: use local Pydantic version detection instead of internal _compat
Replace `from fastapi._compat import PYDANTIC_V2` with local version detection to avoid ImportError in redistribute/slim package tests where fastapi._compat internals are not available. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
34c0142517
commit
d7cb6f2538
|
|
@ -8,11 +8,13 @@ explicitly provided vs. which fields use defaults.
|
|||
|
||||
from typing import Annotated
|
||||
|
||||
import pydantic
|
||||
from fastapi import FastAPI, Form, Header, Query
|
||||
from fastapi._compat import PYDANTIC_V2
|
||||
from fastapi.testclient import TestClient
|
||||
from pydantic import BaseModel
|
||||
|
||||
PYDANTIC_V2 = int(pydantic.VERSION.split(".")[0]) >= 2
|
||||
|
||||
|
||||
class FormModelFieldsSet(BaseModel):
|
||||
"""Model for testing fields_set metadata preservation."""
|
||||
|
|
|
|||
Loading…
Reference in New Issue