From d97415b44f49ebb1e0bd58b6bd96e31951101eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Wed, 8 Oct 2025 16:42:00 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Update=20tests=20to=20handle=20Pyth?= =?UTF-8?q?on=203.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_union_body_discriminator.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/test_union_body_discriminator.py b/tests/test_union_body_discriminator.py index 39db98467..6af9e1d22 100644 --- a/tests/test_union_body_discriminator.py +++ b/tests/test_union_body_discriminator.py @@ -1,5 +1,6 @@ from typing import Any, Dict, Union +from dirty_equals import IsDict from fastapi import FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot @@ -92,11 +93,21 @@ def test_discriminator_pydantic_v2() -> None: "description": "Successful Response", "content": { "application/json": { - "schema": { - "type": "object", - "additionalProperties": True, - "title": "Response Save Union Body Discriminator Items Post", - } + "schema": IsDict( + { + # Pydantic 2.10, in Python 3.8 + # TODO: remove when dropping support for Python 3.8 + "type": "object", + "title": "Response Save Union Body Discriminator Items Post", + } + ) + | IsDict( + { + "type": "object", + "additionalProperties": True, + "title": "Response Save Union Body Discriminator Items Post", + } + ) } }, },