From ec092b703b0eca18bad7f7d7ce9be1a644ddc49f Mon Sep 17 00:00:00 2001 From: Isaac To Date: Tue, 27 Aug 2024 17:59:47 -0700 Subject: [PATCH] Eliminate use of `from __future__ import annotations` in test_tools.py The use of `from __future__ import annotations` solicit hard to predict behaviors from Pydantic and Typer in older Python versions --- tests/test_tools.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/test_tools.py b/tests/test_tools.py index 53862df9..483e4dab 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import re from enum import Enum, auto from operator import itemgetter @@ -69,7 +67,7 @@ class A(BaseModel): class B(BaseModel): x: A y: Optional[A] - z: B + z: "B" a_schema = A.__pydantic_core_schema__ b_schema = B.__pydantic_core_schema__ @@ -122,7 +120,7 @@ class A(BaseModel): class B(A): x: A - y: B + y: "B" with pytest.raises( ValueError, match="`context` must be a `DefinitionsSchema` object" @@ -140,11 +138,11 @@ class A(BaseModel): class B(BaseModel): x: A - y: B + y: "B" class C(BaseModel): a: A - c: C + c: "C" with pytest.raises(RuntimeError, match="not found in provided context"): resolve_ref_schema(C.__pydantic_core_schema__, B.__pydantic_core_schema__) @@ -162,7 +160,7 @@ class A(BaseModel): class B(A): x: A - y: B + y: "B" a_schema = A.__pydantic_core_schema__ b_schema = B.__pydantic_core_schema__