Skip to content

Commit

Permalink
Add testing of serialization
Browse files Browse the repository at this point in the history
Signed-off-by: ReRubis <[email protected]>
  • Loading branch information
ReRubis committed Dec 31, 2023
1 parent 14b738d commit 07b4aa7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/test_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ class TestModel(BaseModel):
assert isinstance(model.color, Color)
assert model.color == color

assert model.model_dump(mode='json') == f'{{"color": "{int(color)}"}}'
assert model.model_dump() == {'color': int(color)}


def test_color_error_in_models():
class TestModel(BaseModel):
Expand All @@ -97,6 +100,7 @@ class TestModel(BaseModel):
with pytest.raises(ValueError):
TestModel(color='not a color')


# @pytest.mark.parametrize('img_name', [Path(f'tests/data/{file_name}') for file_name in TEST_FILE_NAMES])
# def test_base64_images_in_models(img_name: Path):
# class TestModel(BaseModel):
Expand Down

0 comments on commit 07b4aa7

Please sign in to comment.