From 60ad91ead600c901d4e144685a359c6aa4b30232 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Tue, 8 Feb 2022 14:43:23 +0000 Subject: [PATCH] tests: coverage in correlator increased --- tests/correlators_test.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/correlators_test.py b/tests/correlators_test.py index 556afa1c..1a394d63 100644 --- a/tests/correlators_test.py +++ b/tests/correlators_test.py @@ -98,6 +98,9 @@ def test_m_eff(): with pytest.warns(RuntimeWarning): my_corr.m_eff('sinh') + with pytest.raises(Exception): + my_corr.m_eff('unkown_variant') + def test_reweighting(): my_corr = pe.correlators.Corr([pe.pseudo_Obs(10, 0.1, 't'), pe.pseudo_Obs(0, 0.05, 't')]) @@ -175,6 +178,7 @@ def test_utility(): corr.print() corr.print([2, 4]) corr.show() + corr.show(comp=corr) corr.dump('test_dump', datatype="pickle", path='.') corr.dump('test_dump', datatype="pickle") @@ -195,6 +199,21 @@ def test_utility(): assert np.allclose(o_a[0].deltas['t'], o_b[0].deltas['t']) +def test_prange(): + corr_content = [] + for t in range(8): + corr_content.append(pe.pseudo_Obs(2 + 10 ** (1.1 * t), 0.2, 't')) + corr = pe.correlators.Corr(corr_content) + + corr.set_prange([2, 4]) + with pytest.raises(Exception): + corr.set_prange([2]) + with pytest.raises(Exception): + corr.set_prange([2, 2.3]) + with pytest.raises(Exception): + corr.set_prange([4, 1]) + + def test_matrix_corr(): def _gen_corr(val): corr_content = [] @@ -242,7 +261,16 @@ def test_matrix_corr(): corr_mat.plateau([2, 4]) with pytest.raises(Exception): - corr_o.item(0, 0) + corr_mat.hankel(3) + + with pytest.raises(Exception): + corr_mat.fit(lambda x: x[0]) + + with pytest.raises(Exception): + corr_0.item(0, 0) + + with pytest.raises(Exception): + corr_0.matrix_symmetric() def test_hankel():