Skip to content
Snippets Groups Projects
Commit 8b80402f authored by Maurice Herné's avatar Maurice Herné
Browse files

Excluded the line from code coverage because I was unable to find a way to...

Excluded the line from code coverage because I was unable to find a way to trigger this error. This may very well be dead code but I was unable to find any documentation from pydantic about in which cases data is not a dict. They use the Any annotation in all examples so it may not be a dict for some reason. The only way I can think of would be for another model_validator changing the type of data which is not the case here.
parent 1d831f39
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ class ConfigurationModel(ConfiguredBaseModel):
Since this only happens during the startup of the application, I consider this to be a positive side effect that protects against errors.
"""
if not isinstance(data, dict):
raise TypeError(f"data must be a dict, not {type(data)}")
raise TypeError(f"data must be a dict, not {type(data)}") # pragma: no cover # I don't know of any way to trigger this error but I feel better having it here just in case.
for field, info in cls.model_fields.items():
data.setdefault(field, environ.get(field, info.default))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment