diff --git a/tests/tests_mapper/params/model_bindings_mapper_parameters.py b/tests/tests_mapper/params/model_bindings_mapper_parameters.py index 9cf576a..3f10826 100644 --- a/tests/tests_mapper/params/model_bindings_mapper_parameters.py +++ b/tests/tests_mapper/params/model_bindings_mapper_parameters.py @@ -7,6 +7,7 @@ BasicNestedModel, BasicSimpleModel, ) +from tests.tests_mapper.params.models.empty_default_only_model import DefaultOnly, Empty from tests.tests_mapper.params.models.grouping_model import GroupingComplexModel from tests.tests_mapper.params.models.nested_grouping_model import ( GroupingNestedComplexModel, @@ -256,3 +257,16 @@ ], ), ] + +empty_default_only_model_parameters = [ + ModelBindingsMapperParameter( + model=Empty, + bindings=[{} for _ in range(100)], + expected=[{} for _ in range(100)], + ), + ModelBindingsMapperParameter( + model=DefaultOnly, + bindings=[{} for _ in range(100)], + expected=[{"x": 1} for _ in range(100)], + ), +] diff --git a/tests/tests_mapper/params/models/empty_default_only_model.py b/tests/tests_mapper/params/models/empty_default_only_model.py new file mode 100644 index 0000000..4a69566 --- /dev/null +++ b/tests/tests_mapper/params/models/empty_default_only_model.py @@ -0,0 +1,11 @@ +"""Models for testing empty/defaul-only model cases.""" + +from pydantic import BaseModel + + +class Empty(BaseModel): + pass + + +class DefaultOnly(BaseModel): + x: int = 1 diff --git a/tests/tests_mapper/test_model_bindings_mapper.py b/tests/tests_mapper/test_model_bindings_mapper.py index cc5566b..269bd16 100644 --- a/tests/tests_mapper/test_model_bindings_mapper.py +++ b/tests/tests_mapper/test_model_bindings_mapper.py @@ -8,6 +8,7 @@ author_array_collection_parameters, author_work_title_parameters, basic_parameters, + empty_default_only_model_parameters, grouping_nested_model_parameters, grouping_parameters, nested_grouping_parameters, @@ -23,6 +24,7 @@ *author_work_title_parameters, *author_array_collection_parameters, *grouping_nested_model_parameters, + *empty_default_only_model_parameters, ], ) def test_basic_model_bindings_mapper(model, bindings, expected):