Skip to content

Commit

Permalink
Make type hints backward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
cswartzvi committed Sep 12, 2024
1 parent c587666 commit f888ef0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/integrations/pydantic/test_pydantic_data_quality.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any
from typing import Any, Dict, List

import pytest
from pydantic import BaseModel, ValidationError
Expand All @@ -23,7 +23,7 @@ class DummyModel(BaseModel):
value: float

@check_output(model=DummyModel, importance="warn")
def dummy() -> dict[str, float]:
def dummy() -> Dict[str, float]:
return {"value": 15.0}

node = Node.from_fn(dummy)
Expand All @@ -49,7 +49,7 @@ class DummyModel(BaseModel):
value: float

@check_output(model=DummyModel, importance="warn")
def dummy() -> dict[str, float]:
def dummy() -> Dict[str, float]:
return {"value": "fifteen"} # type: ignore

node = Node.from_fn(dummy)
Expand Down Expand Up @@ -80,7 +80,7 @@ class Version(BaseModel):
class Repo(BaseModel):
name: str
owner: Owner
versions: list[Version]
versions: List[Version]

data = {
"name": "hamilton",
Expand All @@ -104,7 +104,7 @@ class Version(BaseModel):
class Repo(BaseModel):
name: str
owner: Owner
versions: list[Version]
versions: List[Version]

data = {
"name": "hamilton",
Expand All @@ -128,10 +128,10 @@ class Version(BaseModel):
class Repo(BaseModel):
name: str
owner: Owner
versions: list[Version]
versions: List[Version]

@check_output(model=Repo, importance="warn")
def dummy() -> dict[str, Any]:
def dummy() -> Dict[str, Any]:
return {
"name": "hamilton",
"owner": {"name": "DAGWorks-Inc"},
Expand All @@ -157,10 +157,10 @@ class Version(BaseModel):
class Repo(BaseModel):
name: str
owner: Owner
versions: list[Version]
versions: List[Version]

@check_output(model=Repo, importance="warn")
def dummy() -> dict[str, Any]:
def dummy() -> Dict[str, Any]:
return {
"name": "hamilton",
"owner": {"name": "DAGWorks-Inc"},
Expand Down Expand Up @@ -221,7 +221,7 @@ class Version(BaseModel):
class Repo(BaseModel):
name: str
owner: Owner
versions: list[Version]
versions: List[Version]

def dummy() -> Repo:
return Repo(
Expand Down Expand Up @@ -249,7 +249,7 @@ class Version(BaseModel):
class Repo(BaseModel):
name: str
owner: Owner
versions: list[Version]
versions: List[Version]

def dummy() -> Repo:
return Repo(
Expand Down

0 comments on commit f888ef0

Please sign in to comment.