Skip to content

Commit

Permalink
test: adapt tests for grouping by field feature
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-pl committed Dec 2, 2024
1 parent ff6abd2 commit bf7d08d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/data/models/author_array_collection_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@


class Work(BaseModel):
model_config = ConfigDict(group_by="work_name")
model_config = ConfigDict(group_by="name")

name: Annotated[str, SPARQLBinding("work_name")]
viafs: Annotated[list[str], SPARQLBinding("viaf")]


class Author(BaseModel):
model_config = ConfigDict(group_by="nameLabel")
model_config = ConfigDict(group_by="surname")

gnd: str
surname: Annotated[str, SPARQLBinding("nameLabel")]
Expand Down
2 changes: 1 addition & 1 deletion tests/data/models/author_work_title_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Work(BaseModel):


class Author(BaseModel):
model_config = ConfigDict(group_by="author")
model_config = ConfigDict(group_by="name")

name: Annotated[str, SPARQLBinding("author")]
works: list[Work]
4 changes: 3 additions & 1 deletion tests/data/models/grouping_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Grouping model for RDFProxy testing."""

from pydantic import BaseModel, ConfigDict
from pydantic import BaseModel, ConfigDict, Field


class GroupingSimpleModel(BaseModel):
Expand All @@ -16,5 +16,7 @@ class GroupingNestedModel(BaseModel):
class GroupingComplexModel(BaseModel):
model_config = ConfigDict(group_by="x")

x: int = Field(exclude=True)

p: str
q: list[GroupingNestedModel]
6 changes: 5 additions & 1 deletion tests/data/models/nested_grouping_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Nested grouping model for RDFProxy testing."""

from pydantic import BaseModel, ConfigDict
from pydantic import BaseModel, ConfigDict, Field


class NestedGroupingSimpleModel(BaseModel):
Expand All @@ -11,12 +11,16 @@ class NestedGroupingSimpleModel(BaseModel):
class NestedGroupingNestedModel(BaseModel):
model_config = ConfigDict(group_by="y")

y: int = Field(exclude=True)

a: str
b: list[NestedGroupingSimpleModel]


class NestedGroupingComplexModel(BaseModel):
model_config = ConfigDict(group_by="a")

a: str = Field(exclude=True)

p: str
q: list[NestedGroupingNestedModel]

0 comments on commit bf7d08d

Please sign in to comment.