From ba94e52fd8a87a4b21cae87b6832a69ea5430b5b Mon Sep 17 00:00:00 2001 From: gmuloc Date: Wed, 15 Nov 2023 11:13:38 +0100 Subject: [PATCH] CI: Thanks mypy my best friend, my code was wrong --- tests/units/test_catalog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/units/test_catalog.py b/tests/units/test_catalog.py index 56b279398..cf11462f3 100644 --- a/tests/units/test_catalog.py +++ b/tests/units/test_catalog.py @@ -222,7 +222,7 @@ def test_parse_fail(self, catalog_data: dict[str, Any]) -> None: """ with pytest.raises((ValidationError, ValueError)) as exec_info: AntaCatalog.parse(str(DATA_DIR / catalog_data["filename"])) - if exec_info.type == ValidationError: + if isinstance(exec_info.value, ValidationError): assert catalog_data["error"] in exec_info.value.errors()[0]["msg"] else: assert catalog_data["error"] in str(exec_info) @@ -257,7 +257,7 @@ def test_from_dict_fail(self, catalog_data: dict[str, Any]) -> None: data = safe_load(file) with pytest.raises((ValidationError, ValueError)) as exec_info: AntaCatalog.from_dict(data) - if exec_info.type == ValidationError: + if isinstance(exec_info.value, ValidationError): assert catalog_data["error"] in exec_info.value.errors()[0]["msg"] else: assert catalog_data["error"] in str(exec_info)