Skip to content

Commit

Permalink
test: implement sad path tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-pl committed Nov 11, 2024
1 parent 6a22267 commit b3be31f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/tests_mapper/test_sad_path_adapter_grouped_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest

from pydantic import BaseModel, ConfigDict
from rdfproxy import ModelBindingsMapper
from rdfproxy.utils._exceptions import (
MissingModelConfigException,
UnboundGroupingKeyException,
)


class ModelMissingGroupByConfig(BaseModel):
x: list[int]


class ModelMissingGroupByValue(BaseModel):
model_config = ConfigDict(group_by="y")

x: list[int]


def test_sad_path_adapter_missing_grouping_config():
with pytest.raises(MissingModelConfigException):
ModelBindingsMapper(ModelMissingGroupByConfig, {"x": 1}).get_models()


def test_sad_path_adapter_missing_grouping_value():
with pytest.raises(UnboundGroupingKeyException):
ModelBindingsMapper(ModelMissingGroupByValue, {"x": 1}).get_models()

0 comments on commit b3be31f

Please sign in to comment.