From 083e029fd0064eb20cd1b571c1caaaee8c74a5d3 Mon Sep 17 00:00:00 2001 From: Barry57 <160387047+Barry57@users.noreply.github.com> Date: Mon, 28 Oct 2024 01:03:02 +0800 Subject: [PATCH] Delete pytest/test_inprod_bspline.py --- pytest/test_inprod_bspline.py | 63 ----------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 pytest/test_inprod_bspline.py diff --git a/pytest/test_inprod_bspline.py b/pytest/test_inprod_bspline.py deleted file mode 100644 index 3d574e1..0000000 --- a/pytest/test_inprod_bspline.py +++ /dev/null @@ -1,63 +0,0 @@ -import pytest -import numpy as np -import pandas as pd -from GENetLib.create_basis import create_bspline_basis -from GENetLib.fd import fd -from GENetLib.inprod_bspline import inprod_bspline - -def create_test_basis(nbasis, norder): - rangeval = [0, 1] - breaks = np.linspace(rangeval[0], rangeval[1], nbasis + norder - 2) - basisobj = create_bspline_basis(rangeval, nbasis, norder, breaks) - return basisobj - -def create_test_fdobj(basisobj, coef): - fdobj = fd(coef=coef, basisobj=basisobj) - return fdobj - -def test_inprod_bspline_normal(): - nbasis = 4 - norder = 2 - basisobj1 = create_test_basis(nbasis, norder) - basisobj2 = create_test_basis(nbasis, norder) - coef1 = np.random.rand(nbasis) - coef2 = np.random.rand(nbasis) - fdobj1 = create_test_fdobj(basisobj1, coef1) - fdobj2 = create_test_fdobj(basisobj2, coef2) - result = inprod_bspline(fdobj1, fdobj2) - assert result.shape == (1, 1) - -def test_inprod_bspline_diff_knots(): - nbasis = 4 - norder = 2 - basisobj1 = create_test_basis(nbasis, norder) - basisobj2 = create_test_basis(nbasis + 1, norder) - coef1 = np.random.rand(nbasis) - coef2 = np.random.rand(nbasis + 1) - fdobj1 = create_test_fdobj(basisobj1, coef1) - fdobj2 = create_test_fdobj(basisobj2, coef2) - with pytest.raises(Exception): - inprod_bspline(fdobj1, fdobj2) - -def test_inprod_bspline_diff_range(): - nbasis = 4 - norder = 2 - basisobj1 = create_test_basis(nbasis, norder) - basisobj2 = create_test_basis(nbasis, norder, rangeval=[1, 2]) - coef1 = np.random.rand(nbasis) - coef2 = np.random.rand(nbasis) - fdobj1 = create_test_fdobj(basisobj1, coef1) - fdobj2 = create_test_fdobj(basisobj2, coef2) - with pytest.raises(Exception): - inprod_bspline(fdobj1, fdobj2) - -def test_inprod_bspline_invalid_coef_dim(): - nbasis = 4 - norder = 2 - basisobj = create_test_basis(nbasis, norder) - coef1 = np.random.rand(nbasis, 2) - coef2 = np.random.rand(nbasis) - fdobj1 = create_test_fdobj(basisobj, coef1) - fdobj2 = create_test_fdobj(basisobj, coef2) - with pytest.raises(Exception): - inprod_bspline(fdobj1, fdobj2)