Skip to content

Commit 4b1f9fe

Browse files
fix models equality check
1 parent e46c054 commit 4b1f9fe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/models-library/tests/test_utils_common_validators.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class ModelWithPreValidator(BaseModel):
2626

2727
# with Enum1
2828
model = Model(color=Enum1.RED)
29-
assert ModelWithPreValidator(color=Enum1.RED) == model
29+
# See: https://docs.pydantic.dev/latest/migration/#changes-to-pydanticbasemodel
30+
assert ModelWithPreValidator(color=Enum1.RED).model_dump() == model.model_dump()
3031

3132
# with Enum2
3233
class Enum2(Enum):
@@ -35,7 +36,8 @@ class Enum2(Enum):
3536
with pytest.raises(ValidationError):
3637
Model(color=Enum2.RED)
3738

38-
assert ModelWithPreValidator(color=Enum2.RED) == model
39+
# See: https://docs.pydantic.dev/latest/migration/#changes-to-pydanticbasemodel
40+
assert ModelWithPreValidator(color=Enum2.RED).model_dump() == model.model_dump()
3941

4042

4143
def test_empty_str_to_none_pre_validator():

0 commit comments

Comments
 (0)