Skip to content

Commit d13a47c

Browse files
committed
fix: pydantic warnings
PydanticDeprecatedSince211: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
1 parent afd26e3 commit d13a47c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

scim2_tester/filling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def fill_with_random_values(
6262
) -> Resource:
6363
"""Fill an object with random values generated according the attribute types."""
6464
garbages = []
65-
for field_name in field_names or obj.model_fields.keys():
66-
field = obj.model_fields[field_name]
65+
for field_name in field_names or obj.__class__.model_fields.keys():
66+
field = obj.__class__.model_fields[field_name]
6767
if field.default:
6868
continue
6969

tests/test_resource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_random_values():
4949
"""Check that 'fill_with_random_values' produce valid objects."""
5050
obj = CustomModel()
5151
fill_with_random_values(None, obj)
52-
for field_name in obj.model_fields:
52+
for field_name in obj.__class__.model_fields:
5353
if field_name == "meta":
5454
continue
5555

0 commit comments

Comments
 (0)