From 5844cfa3533f9a4185dcf4216bf08ae9b3ff1c41 Mon Sep 17 00:00:00 2001 From: torradocacho Date: Tue, 17 May 2022 14:34:20 +0200 Subject: [PATCH] bugfix: install test --- cobaya/component.py | 2 +- tests/test_cosmo_run.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cobaya/component.py b/cobaya/component.py index dc7945562..ce26be9ee 100644 --- a/cobaya/component.py +++ b/cobaya/component.py @@ -560,7 +560,7 @@ def check_kind_and_return(cls): """ if kind is not None: if not issubclass(cls, get_base_classes()[kind]): - raise TypeError("Class %r is not a standard class type %r", name, kinds) + raise TypeError(f"Class '{name}' is not a standard class of type {kind}.") return cls def check_if_ComponentNotFoundError_and_raise(_excpt, not_found_msg=_not_found_msg, diff --git a/tests/test_cosmo_run.py b/tests/test_cosmo_run.py index 7224d7084..b7e8531e9 100644 --- a/tests/test_cosmo_run.py +++ b/tests/test_cosmo_run.py @@ -5,6 +5,7 @@ from getdist.mcsamples import MCSamplesFromCobaya, loadMCSamples from cobaya import mpi, run, Theory, InputDict, PostDict, LoggedError from cobaya.conventions import Extension +from cobaya.component import ComponentNotFoundError from cobaya.tools import deepcopy_where_possible from cobaya.cosmo_input.convert_cosmomc import cosmomc_root_to_cobaya_info_dict from cobaya.log import NoLogging @@ -72,14 +73,12 @@ def test_cosmo_run_not_found(): with NoLogging(logging.ERROR): inf = deepcopy_where_possible(info) inf["likelihood"]["H0.perfect"] = None - with pytest.raises(LoggedError) as e: + with pytest.raises(ComponentNotFoundError): run(inf) - assert "Failed to get defaults for component" in str(e) inf = deepcopy_where_possible(info) inf["likelihood"]["none"] = None - with pytest.raises(LoggedError) as e: + with pytest.raises(ComponentNotFoundError): run(inf) - assert "Failed to get defaults for component" in str(e) inf = deepcopy_where_possible(info) inf["likelihood"]["pandas.plotting.PlotAccessor"] = None with pytest.raises(LoggedError) as e: