From eb8090a90cc2390433a75fbb03961c5707c98276 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Mon, 16 May 2022 13:28:10 +0100 Subject: [PATCH] tests: GEVP tests extended to all three sorting variants. --- tests/correlators_test.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/correlators_test.py b/tests/correlators_test.py index 4d6e9b61..18c578f4 100644 --- a/tests/correlators_test.py +++ b/tests/correlators_test.py @@ -231,22 +231,23 @@ def test_matrix_corr(): corr_mat = pe.Corr(np.array([[corr_aa, corr_ab], [corr_ab, corr_aa]])) corr_mat.item(0, 0) - vecs = corr_mat.GEVP(0, 1, sort=None) + for (ts, sort) in zip([None, 1, 1], ["Eigenvalue", "Eigenvector", None]): + vecs = corr_mat.GEVP(0, ts=ts, sort=sort) - corr_0 = corr_mat.projected(vecs[0]) - corr_1 = corr_mat.projected(vecs[0]) + corr_0 = corr_mat.projected(vecs[0]) + corr_1 = corr_mat.projected(vecs[1]) assert np.all([o == 0 for o in corr_0 - corr_aa]) assert np.all([o == 0 for o in corr_1 - corr_aa]) - corr_mat.GEVP(0, sort="Eigenvalue") - corr_mat.GEVP(0, 1, sort="Eigenvector") - corr_mat.matrix_symmetric() with pytest.warns(RuntimeWarning): corr_mat.GEVP(0, 1, sort="Eigenvalue") + with pytest.raises(Exception): + corr_mat.GEVP(0, 1, sort="This sorting method does not exist.") + with pytest.raises(Exception): corr_mat.plottable()