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)