diff --git a/tests/common/test_tp_likelihood.py b/tests/common/test_tp_likelihood.py index aa56e6e..f5c994c 100644 --- a/tests/common/test_tp_likelihood.py +++ b/tests/common/test_tp_likelihood.py @@ -1,6 +1,6 @@ # -# author: Jungtaek Kim (jtkim@postech.ac.kr) -# last updated: March 22, 2021 +# author: Jungtaek Kim (jungtaek.kim.mail@gmail.com) +# last updated: November 18, 2024 # """test_tp_likelihood""" @@ -13,9 +13,6 @@ from bayeso.utils import utils_covariance -TEST_EPSILON = 1e-7 - - def test_neg_log_ml_typing(): annos = package_target.neg_log_ml.__annotations__ @@ -78,7 +75,7 @@ def test_neg_log_ml(): ) print(neg_log_ml_) truth_log_ml_ = 5.634155417555853 - assert np.abs(neg_log_ml_ - truth_log_ml_) < TEST_EPSILON + np.testing.assert_allclose(neg_log_ml_, truth_log_ml_) neg_log_ml_, neg_grad_log_ml_ = package_target.neg_log_ml( X, Y, arr_hyps, str_cov, prior_mu_X, fix_noise=fix_noise, use_gradient=True @@ -100,8 +97,8 @@ def test_neg_log_ml(): -1.836237221888097e-05, ] ) - assert np.abs(neg_log_ml_ - truth_log_ml_) < TEST_EPSILON - assert np.all(np.abs(neg_grad_log_ml_ - truth_grad_log_ml_) < TEST_EPSILON) + np.testing.assert_allclose(neg_log_ml_, truth_log_ml_) + np.testing.assert_allclose(neg_grad_log_ml_, truth_grad_log_ml_) dict_hyps = utils_covariance.get_hyps(str_cov, dim_X, use_gp=use_gp) arr_hyps = utils_covariance.convert_hyps(