From bf7d08d292553f3638925bfcc628ea6d2ffc725a Mon Sep 17 00:00:00 2001 From: Lukas Plank Date: Mon, 2 Dec 2024 14:15:11 +0100 Subject: [PATCH] test: adapt tests for grouping by field feature --- tests/data/models/author_array_collection_model.py | 4 ++-- tests/data/models/author_work_title_model.py | 2 +- tests/data/models/grouping_model.py | 4 +++- tests/data/models/nested_grouping_model.py | 6 +++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/data/models/author_array_collection_model.py b/tests/data/models/author_array_collection_model.py index d1d7a3f..131a957 100644 --- a/tests/data/models/author_array_collection_model.py +++ b/tests/data/models/author_array_collection_model.py @@ -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")] diff --git a/tests/data/models/author_work_title_model.py b/tests/data/models/author_work_title_model.py index d69eb2f..f934314 100644 --- a/tests/data/models/author_work_title_model.py +++ b/tests/data/models/author_work_title_model.py @@ -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] diff --git a/tests/data/models/grouping_model.py b/tests/data/models/grouping_model.py index 35d21a0..9289f92 100644 --- a/tests/data/models/grouping_model.py +++ b/tests/data/models/grouping_model.py @@ -1,6 +1,6 @@ """Grouping model for RDFProxy testing.""" -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field class GroupingSimpleModel(BaseModel): @@ -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] diff --git a/tests/data/models/nested_grouping_model.py b/tests/data/models/nested_grouping_model.py index 8b88bfa..89fd0d3 100644 --- a/tests/data/models/nested_grouping_model.py +++ b/tests/data/models/nested_grouping_model.py @@ -1,6 +1,6 @@ """Nested grouping model for RDFProxy testing.""" -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field class NestedGroupingSimpleModel(BaseModel): @@ -11,6 +11,8 @@ class NestedGroupingSimpleModel(BaseModel): class NestedGroupingNestedModel(BaseModel): model_config = ConfigDict(group_by="y") + y: int = Field(exclude=True) + a: str b: list[NestedGroupingSimpleModel] @@ -18,5 +20,7 @@ class NestedGroupingNestedModel(BaseModel): class NestedGroupingComplexModel(BaseModel): model_config = ConfigDict(group_by="a") + a: str = Field(exclude=True) + p: str q: list[NestedGroupingNestedModel]