From 8b80402f1359bd2bdf14eb653ab8588bdfc43abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maurice=20Hern=C3=A9?= <maurice.herne@rwth-aachen.de> Date: Thu, 7 Nov 2024 01:00:26 +0100 Subject: [PATCH] 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. --- .../configuration/models/configuration_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Notebook_Processor/configuration/models/configuration_model.py b/src/Notebook_Processor/configuration/models/configuration_model.py index 7f24827..8b80452 100644 --- a/src/Notebook_Processor/configuration/models/configuration_model.py +++ b/src/Notebook_Processor/configuration/models/configuration_model.py @@ -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)) -- GitLab