Skip to content

Commit

Permalink
Eliminate use of from __future__ import annotations in test_tools.py
Browse files Browse the repository at this point in the history
The use of `from __future__ import annotations` solicit hard to
predict behaviors from Pydantic and Typer in older Python versions
  • Loading branch information
candleindark committed Aug 28, 2024
1 parent 6975a5a commit ec092b7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import re
from enum import Enum, auto
from operator import itemgetter
Expand Down Expand Up @@ -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__
Expand Down Expand Up @@ -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"
Expand All @@ -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__)
Expand All @@ -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__
Expand Down

0 comments on commit ec092b7

Please sign in to comment.