From b73dacf54402ca0921fbb854c5f949811b9fb8c4 Mon Sep 17 00:00:00 2001 From: Brandon Dube Date: Mon, 2 Sep 2019 17:10:35 -0700 Subject: [PATCH] + jacobi, q poly tests --- tests/test_jacobi.py | 21 +++++++++++++++++++++ tests/test_qpoly.py | 19 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/test_jacobi.py create mode 100644 tests/test_qpoly.py diff --git a/tests/test_jacobi.py b/tests/test_jacobi.py new file mode 100644 index 00000000..3509b3c8 --- /dev/null +++ b/tests/test_jacobi.py @@ -0,0 +1,21 @@ +"""Jacobi submodule tests.""" + +import numpy as np + +import pytest + +from scipy.special import jacobi as sps_jac + +from prysm import jacobi as pjac + +@pytest.mark.parametrize('n', [0, 1, 2, 3, 4]) +@pytest.mark.parametrize('alpha, beta', [ + (0,0), + (1,1), + (-0.75,0), + (1,-0.75)]) +def test_jacobi_1_4_match_scipy(n, alpha, beta): + x = np.linspace(-1, 1, 32) + prysm_ = pjac.jacobi(n=n, alpha=alpha, beta=beta, x=x) + scipy_ = sps_jac(n=n, alpha=alpha, beta=beta)(x) + assert np.allclose(prysm_, scipy_) diff --git a/tests/test_qpoly.py b/tests/test_qpoly.py new file mode 100644 index 00000000..27d207de --- /dev/null +++ b/tests/test_qpoly.py @@ -0,0 +1,19 @@ +"""Q polynomial tests.""" + +import pytest + +from prysm import qpoly + + +@pytest.mark.parametrize('n', [0, 1, 2, 3, 4, 5, 6]) +def test_qbfs_functions(n): + args = {f'A{n}': 1} + qbfs_sag = qpoly.QBFSSag(**args) + assert qbfs_sag + + +@pytest.mark.parametrize('n', [0, 1, 2, 3, 4, 5, 6]) +def test_qcon_functions(n): + args = {f'A{n}': 1} + qcon_sag = qpoly.QCONSag(**args) + assert qcon_sag