Skip to content

Commit

Permalink
Improving tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitenti committed Apr 22, 2024
1 parent 5d1f746 commit 9d29314
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/meson.build
Expand Up @@ -507,7 +507,7 @@ if enable_gir
numcosmo_source_dir,
)

pytest_args = ['-m', 'pytest', '-s']
pytest_args = ['-m', 'pytest']
pytest_protocol = 'exitcode'

py_tap = python_module.find_installation(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ncm_fftlog.c
Expand Up @@ -325,7 +325,7 @@ test_ncm_fftlog_gausswin2_new (TestNcmFftlog *test, gconstpointer pdata)
void
test_ncm_fftlog_sbessel_j_new (TestNcmFftlog *test, gconstpointer pdata)
{
const guint N = g_test_rand_int_range (2800, 3000);
const guint N = g_test_rand_int_range (3800, 4000);
const guint ell = g_test_rand_int_range (0, 5);
NcmFftlog *fftlog = NCM_FFTLOG (ncm_fftlog_sbessel_j_new (ell, 0.0, 0.0, 20.0, N));
TestNcmFftlogK *argK = g_new (TestNcmFftlogK, 1);
Expand Down Expand Up @@ -365,7 +365,7 @@ test_ncm_fftlog_sbessel_j_new (TestNcmFftlog *test, gconstpointer pdata)
void
test_ncm_fftlog_sbessel_j_q0_5_new (TestNcmFftlog *test, gconstpointer pdata)
{
const guint N = g_test_rand_int_range (2800, 3000);
const guint N = g_test_rand_int_range (3800, 4000);
const guint ell = g_test_rand_int_range (0, 5);
NcmFftlog *fftlog = NCM_FFTLOG (ncm_fftlog_sbessel_j_new (ell, 0.0, 0.0, 20.0, N));
TestNcmFftlogK *argK = g_new (TestNcmFftlogK, 1);
Expand Down
19 changes: 11 additions & 8 deletions tests/test_py_ode_spline.py
Expand Up @@ -32,21 +32,26 @@


class RhsF:
"""Test function for the ODE, it describes the right-hand
side of the equation $y_x = f(y,x)$."""
"""Test function for the ODE.
It describes the right-hand side of the equation $y_x = f(y,x)$.
"""

def __init__(self, alpha):
"""Initialize the test function."""
self.alpha = alpha

def rhs(self, y, _x, _data):
r"""Test function for the ODE, it describes the right-hand
side of the equation $y_x = f(y,x)$, here we use $f(y,x) = \alpha y$."""
r"""Test function for the ODE.
It describes the right-hand side of the equation $y_x = f(y,x)$, here we use
$f(y,x) = \alpha y$.
"""
return self.alpha * y


def test_ode_spline() -> None:
"""Test function for the ODE spline."""

f = RhsF(2.5)

s = Ncm.SplineCubicNotaknot.new()
Expand Down Expand Up @@ -74,7 +79,6 @@ def test_ode_spline() -> None:

def test_ode_spline_copy_props() -> None:
"""Test function for the ODE spline."""

f = RhsF(2.5)

s = Ncm.SplineCubicNotaknot.new()
Expand All @@ -92,9 +96,8 @@ def test_ode_spline_copy_props() -> None:

os = Ncm.OdeSpline.new(s, f.rhs)
for prop in os0.list_properties():
if prop.name == "dydx" or prop.name == "yf":
if prop.name in ("dydx", "yf"):
continue
print(prop.name)
os.set_property(prop.name, os0.get_property(prop.name))

assert isinstance(os, Ncm.OdeSpline)
Expand Down

0 comments on commit 9d29314

Please sign in to comment.