Skip to content

Commit

Permalink
fix errors in test_pydantic.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend committed Dec 23, 2023
1 parent 18a87c0 commit b2e6cc0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/utils/test_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ class Concert(Table):
# Test two levels deep

BandModel = create_pydantic_model(
table=Band, nested=(Band.manager.country,)
table=Band, nested=(Band.manager._.country,)
)

ManagerModel = t.cast(
Expand Down Expand Up @@ -679,7 +679,7 @@ class Concert(Table):
# Test three levels deep

ConcertModel = create_pydantic_model(
Concert, nested=(Concert.band_1.manager,)
Concert, nested=(Concert.band_1._.manager,)
)

VenueModel = ConcertModel.model_fields["venue"].annotation
Expand Down Expand Up @@ -720,11 +720,14 @@ class Concert(Table):

MyConcertModel = create_pydantic_model(
Concert,
nested=(Concert.band_1.manager,),
nested=(Concert.band_1._.manager,),
model_name="MyConcertModel",
)

BandModel = MyConcertModel.model_fields["band_1"].annotation
BandModel = t.cast(
t.Type[pydantic.BaseModel],
MyConcertModel.model_fields["band_1"].annotation,
)
self.assertEqual(BandModel.__qualname__, "MyConcertModel.band_1")

ManagerModel = BandModel.model_fields["manager"].annotation
Expand Down

0 comments on commit b2e6cc0

Please # to comment.