Skip to content

Commit d11c4a8

Browse files
committed
fixed tests
1 parent 4fc08a9 commit d11c4a8

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/models-library/src/models_library/service_settings_labels.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ def _not_allowed_in_both_specs(self):
570570
"containers_allowed_outgoing_internet",
571571
"containers_allowed_outgoing_permit_list",
572572
}
573-
if match_keys & set(self.model_fields) != match_keys:
574-
err_msg = f"Expected the following keys {match_keys} to be present {self.model_fields=}"
573+
if match_keys & set(self.__class__.model_fields) != match_keys:
574+
err_msg = f"Expected the following keys {match_keys} to be present {self.__class__.model_fields=}"
575575
raise ValueError(err_msg)
576576

577577
if (

packages/models-library/tests/test__pydantic_models.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" This test suite does not intend to re-test pydantic but rather
1+
"""This test suite does not intend to re-test pydantic but rather
22
check some "corner cases" or critical setups with pydantic model such that:
33
44
- we can ensure a given behaviour is preserved through updates
@@ -120,7 +120,7 @@ class Func(BaseModel):
120120
{"$ref": "#/$defs/DatCoreFileLink"},
121121
{"$ref": "#/$defs/DownloadLink"},
122122
{"type": "array", "items": {}},
123-
{"type": "object"},
123+
{"additionalProperties": True, "type": "object"},
124124
],
125125
}
126126

@@ -183,7 +183,9 @@ def test_nullable_fields_from_pydantic_v1():
183183
# SEE https://github.com/ITISFoundation/osparc-simcore/pull/6751
184184
class MyModel(BaseModel):
185185
# pydanticv1 would add a default to fields set as nullable
186-
nullable_required: str | None # <--- This was default to =None in pydantic 1 !!!
186+
nullable_required: (
187+
str | None
188+
) # <--- This was default to =None in pydantic 1 !!!
187189
nullable_required_with_hyphen: str | None = Field(default=...)
188190
nullable_optional: str | None = None
189191

0 commit comments

Comments
 (0)