Commit 735e5757 authored by Philipp Arras's avatar Philipp Arras

Do not use deprecated numpy.assert_ any more

parent 31843af9
Pipeline #77646 passed with stages
in 13 minutes and 25 seconds
...@@ -92,7 +92,7 @@ from .library.correlated_fields_simple import SimpleCorrelatedField ...@@ -92,7 +92,7 @@ from .library.correlated_fields_simple import SimpleCorrelatedField
from . import extra from . import extra
from .utilities import memo, frozendict from .utilities import memo, frozendict, myassert
from .logger import logger from .logger import logger
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
from itertools import combinations from itertools import combinations
import numpy as np import numpy as np
from numpy.testing import assert_
from .domain_tuple import DomainTuple from .domain_tuple import DomainTuple
from .field import Field from .field import Field
...@@ -29,6 +28,7 @@ from .operators.energy_operators import EnergyOperator ...@@ -29,6 +28,7 @@ from .operators.energy_operators import EnergyOperator
from .operators.linear_operator import LinearOperator from .operators.linear_operator import LinearOperator
from .operators.operator import Operator from .operators.operator import Operator
from .sugar import from_random from .sugar import from_random
from .utilities import myassert
__all__ = ["check_linear_operator", "check_operator", __all__ = ["check_linear_operator", "check_operator",
"assert_allclose"] "assert_allclose"]
...@@ -137,20 +137,6 @@ def assert_equal(f1, f2): ...@@ -137,20 +137,6 @@ def assert_equal(f1, f2):
assert_equal(val, f2[key]) assert_equal(val, f2[key])
def _nozero(fld):
if isinstance(fld, Field):
return np.testing.assert_((fld != 0).s_all())
for val in fld.values():
_nozero(val)
def _allzero(fld):
if isinstance(fld, Field):
return np.testing.assert_((fld == 0.).s_all())
for val in fld.values():
_allzero(val)
def _adjoint_implementation(op, domain_dtype, target_dtype, atol, rtol, def _adjoint_implementation(op, domain_dtype, target_dtype, atol, rtol,
only_r_linear): only_r_linear):
needed_cap = op.TIMES | op.ADJOINT_TIMES needed_cap = op.TIMES | op.ADJOINT_TIMES
...@@ -206,32 +192,32 @@ def _domain_check_linear(op, domain_dtype=None, inp=None): ...@@ -206,32 +192,32 @@ def _domain_check_linear(op, domain_dtype=None, inp=None):
inp = from_random(op.domain, "normal", dtype=domain_dtype) inp = from_random(op.domain, "normal", dtype=domain_dtype)
elif inp is None: elif inp is None:
raise ValueError('Need to specify either dtype or inp') raise ValueError('Need to specify either dtype or inp')
assert_(inp.domain is op.domain) myassert(inp.domain is op.domain)
assert_(op(inp).domain is op.target) myassert(op(inp).domain is op.target)
def _domain_check_nonlinear(op, loc): def _domain_check_nonlinear(op, loc):
_domain_check(op) _domain_check(op)
assert_(isinstance(loc, (Field, MultiField))) myassert(isinstance(loc, (Field, MultiField)))
assert_(loc.domain is op.domain) myassert(loc.domain is op.domain)
for wm in [False, True]: for wm in [False, True]:
lin = Linearization.make_var(loc, wm) lin = Linearization.make_var(loc, wm)
reslin = op(lin) reslin = op(lin)
assert_(lin.domain is op.domain) myassert(lin.domain is op.domain)
assert_(lin.target is op.domain) myassert(lin.target is op.domain)
assert_(lin.val.domain is lin.domain) myassert(lin.val.domain is lin.domain)
assert_(reslin.domain is op.domain) myassert(reslin.domain is op.domain)
assert_(reslin.target is op.target) myassert(reslin.target is op.target)
assert_(reslin.val.domain is reslin.target) myassert(reslin.val.domain is reslin.target)
assert_(reslin.target is op.target) myassert(reslin.target is op.target)
assert_(reslin.jac.domain is reslin.domain) myassert(reslin.jac.domain is reslin.domain)
assert_(reslin.jac.target is reslin.target) myassert(reslin.jac.target is reslin.target)
assert_(lin.want_metric == reslin.want_metric) myassert(lin.want_metric == reslin.want_metric)
_domain_check_linear(reslin.jac, inp=loc) _domain_check_linear(reslin.jac, inp=loc)
_domain_check_linear(reslin.jac.adjoint, inp=reslin.jac(loc)) _domain_check_linear(reslin.jac.adjoint, inp=reslin.jac(loc))
if reslin.metric is not None: if reslin.metric is not None:
assert_(reslin.metric.domain is reslin.metric.target) myassert(reslin.metric.domain is reslin.metric.target)
assert_(reslin.metric.domain is op.domain) myassert(reslin.metric.domain is op.domain)
def _domain_check(op): def _domain_check(op):
......
...@@ -405,3 +405,10 @@ def lognormal_moments(mean, sigma, N=0): ...@@ -405,3 +405,10 @@ def lognormal_moments(mean, sigma, N=0):
logsigma = np.sqrt(np.log1p((sigma / mean)**2)) logsigma = np.sqrt(np.log1p((sigma / mean)**2))
logmean = np.log(mean) - logsigma**2 / 2 logmean = np.log(mean) - logsigma**2 / 2
return logmean, logsigma return logmean, logsigma
def myassert(val):
"""Safe alternative to python's assert statement which is active even if
`__debug__` is False."""
if not val:
raise AssertionError
...@@ -17,9 +17,10 @@ ...@@ -17,9 +17,10 @@
import numpy as np import numpy as np
import pytest import pytest
from numpy.testing import assert_, assert_allclose, assert_raises from numpy.testing import assert_allclose, assert_raises
import nifty7 as ift import nifty7 as ift
from nifty7 import myassert
from .common import setup_function, teardown_function from .common import setup_function, teardown_function
...@@ -55,13 +56,13 @@ def test_kl(constants, point_estimates, mirror_samples, mf): ...@@ -55,13 +56,13 @@ def test_kl(constants, point_estimates, mirror_samples, mf):
ift.MetricGaussianKL.make(**args) ift.MetricGaussianKL.make(**args)
return return
kl = ift.MetricGaussianKL.make(**args) kl = ift.MetricGaussianKL.make(**args)
assert_(len(ic.history) > 0) myassert(len(ic.history) > 0)
assert_(len(ic.history) == len(ic.history.time_stamps)) myassert(len(ic.history) == len(ic.history.time_stamps))
assert_(len(ic.history) == len(ic.history.energy_values)) myassert(len(ic.history) == len(ic.history.energy_values))
ic.history.reset() ic.history.reset()
assert_(len(ic.history) == 0) myassert(len(ic.history) == 0)
assert_(len(ic.history) == len(ic.history.time_stamps)) myassert(len(ic.history) == len(ic.history.time_stamps))
assert_(len(ic.history) == len(ic.history.energy_values)) myassert(len(ic.history) == len(ic.history.energy_values))
locsamp = kl._local_samples locsamp = kl._local_samples
if isinstance(mean0, ift.MultiField): if isinstance(mean0, ift.MultiField):
...@@ -74,7 +75,7 @@ def test_kl(constants, point_estimates, mirror_samples, mf): ...@@ -74,7 +75,7 @@ def test_kl(constants, point_estimates, mirror_samples, mf):
# Test number of samples # Test number of samples
expected_nsamps = 2*nsamps if mirror_samples else nsamps expected_nsamps = 2*nsamps if mirror_samples else nsamps
assert_(len(tuple(kl.samples)) == expected_nsamps) myassert(len(tuple(kl.samples)) == expected_nsamps)
# Test value # Test value
assert_allclose(kl.value, klpure.value) assert_allclose(kl.value, klpure.value)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import numpy as np import numpy as np
import pytest import pytest
from numpy.testing import assert_, assert_allclose from numpy.testing import assert_allclose
import nifty7 as ift import nifty7 as ift
from .common import setup_function, teardown_function from .common import setup_function, teardown_function
...@@ -44,7 +44,7 @@ def test_special_gradients(): ...@@ -44,7 +44,7 @@ def test_special_gradients():
assert_allclose( assert_allclose(
_lin2grad(ift.Linearization.make_var(0*f).ptw("sinc")), np.zeros(s.shape)) _lin2grad(ift.Linearization.make_var(0*f).ptw("sinc")), np.zeros(s.shape))
assert_(np.isnan(_lin2grad(ift.Linearization.make_var(0*f).ptw("abs")))) ift.myassert(np.isnan(_lin2grad(ift.Linearization.make_var(0*f).ptw("abs"))))
assert_allclose( assert_allclose(
_lin2grad(ift.Linearization.make_var(0*f + 10).ptw("abs")), _lin2grad(ift.Linearization.make_var(0*f + 10).ptw("abs")),
np.ones(s.shape)) np.ones(s.shape))
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import numpy as np import numpy as np
import pytest import pytest
from mpi4py import MPI from mpi4py import MPI
from numpy.testing import assert_, assert_equal, assert_raises from numpy.testing import assert_equal, assert_raises
import nifty7 as ift import nifty7 as ift
...@@ -84,8 +84,8 @@ def test_kl(constants, point_estimates, mirror_samples, mode, mf): ...@@ -84,8 +84,8 @@ def test_kl(constants, point_estimates, mirror_samples, mode, mf):
# Test number of samples # Test number of samples
expected_nsamps = 2*nsamps if mirror_samples else nsamps expected_nsamps = 2*nsamps if mirror_samples else nsamps
assert_(len(tuple(kl0.samples)) == expected_nsamps) ift.myassert(len(tuple(kl0.samples)) == expected_nsamps)
assert_(len(tuple(kl1.samples)) == expected_nsamps) ift.myassert(len(tuple(kl1.samples)) == expected_nsamps)
# Test value # Test value
assert_equal(kl0.value, kl1.value) assert_equal(kl0.value, kl1.value)
......
...@@ -16,14 +16,16 @@ ...@@ -16,14 +16,16 @@
# #
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik. # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
from numpy.testing import assert_, assert_allclose
import numpy as np
from copy import deepcopy from copy import deepcopy
import numpy as np
from numpy.testing import assert_allclose
import nifty7 as ift import nifty7 as ift
class CountingOp(ift.Operator): class CountingOp(ift.Operator):
#FIXME: Not a LinearOperator since ChainOps not supported yet # FIXME: Not a LinearOperator since ChainOps not supported yet
def __init__(self, domain): def __init__(self, domain):
self._domain = self._target = ift.sugar.makeDomain(domain) self._domain = self._target = ift.sugar.makeDomain(domain)
self._count = 0 self._count = 0
...@@ -56,6 +58,6 @@ def test_operator_tree_optimiser(): ...@@ -56,6 +58,6 @@ def test_operator_tree_optimiser():
op_orig = deepcopy(op) op_orig = deepcopy(op)
op = ift.operator_tree_optimiser._optimise_operator(op) op = ift.operator_tree_optimiser._optimise_operator(op)
assert_allclose(op(fld).val, op_orig(fld).val, rtol=np.finfo(np.float64).eps) assert_allclose(op(fld).val, op_orig(fld).val, rtol=np.finfo(np.float64).eps)
assert_(1 == ( (cop4.count-1) * cop3.count * cop2.count * cop1.count)) ift.myassert(1 == ((cop4.count-1) * cop3.count * cop2.count * cop1.count))
# test testing # test testing
ift.optimise_operator(op_orig) ift.optimise_operator(op_orig)
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik. # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import numpy as np import numpy as np
from numpy.testing import assert_, assert_allclose from numpy.testing import assert_allclose
import nifty7 as ift import nifty7 as ift
from nifty7.extra import check_operator, check_linear_operator from nifty7.extra import check_linear_operator, check_operator
from ..common import list2fixture, setup_function, teardown_function from ..common import list2fixture, setup_function, teardown_function
...@@ -42,7 +42,7 @@ def test_linear_einsum_outer(space1, space2, dtype, n_invocations=10): ...@@ -42,7 +42,7 @@ def test_linear_einsum_outer(space1, space2, dtype, n_invocations=10):
ss = "i,ij,j->ij" ss = "i,ij,j->ij"
key_order = ("dom01", "dom02") key_order = ("dom01", "dom02")
le = ift.LinearEinsum(space2, mf, ss, key_order=key_order) le = ift.LinearEinsum(space2, mf, ss, key_order=key_order)
assert_(check_linear_operator(le, domain_dtype=dtype, target_dtype=dtype) is None) ift.myassert(check_linear_operator(le, domain_dtype=dtype, target_dtype=dtype) is None)
le_ift = ift.DiagonalOperator(mf["dom01"], domain=mf_dom["dom02"], spaces=0) @ ift.DiagonalOperator(mf["dom02"]) le_ift = ift.DiagonalOperator(mf["dom01"], domain=mf_dom["dom02"], spaces=0) @ ift.DiagonalOperator(mf["dom02"])
le_ift = le_ift @ ift.OuterProduct(ift.DomainTuple.make(mf_dom["dom02"][1]), le_ift = le_ift @ ift.OuterProduct(ift.DomainTuple.make(mf_dom["dom02"][1]),
...@@ -63,7 +63,7 @@ def test_linear_einsum_contraction(space1, space2, dtype, n_invocations=10): ...@@ -63,7 +63,7 @@ def test_linear_einsum_contraction(space1, space2, dtype, n_invocations=10):
ss = "i,ij,j->i" ss = "i,ij,j->i"
key_order = ("dom01", "dom02") key_order = ("dom01", "dom02")
le = ift.LinearEinsum(space2, mf, ss, key_order=key_order) le = ift.LinearEinsum(space2, mf, ss, key_order=key_order)
assert_(check_linear_operator(le, domain_dtype=dtype, target_dtype=dtype) is None) ift.myassert(check_linear_operator(le, domain_dtype=dtype, target_dtype=dtype) is None)
le_ift = ift.ContractionOperator(mf_dom["dom02"], 1) le_ift = ift.ContractionOperator(mf_dom["dom02"], 1)
le_ift = le_ift @ ift.DiagonalOperator(mf["dom01"], domain=mf_dom["dom02"], spaces=0) le_ift = le_ift @ ift.DiagonalOperator(mf["dom01"], domain=mf_dom["dom02"], spaces=0)
...@@ -116,7 +116,7 @@ def test_linear_einsum_transpose(space1, space2, dtype, n_invocations=10): ...@@ -116,7 +116,7 @@ def test_linear_einsum_transpose(space1, space2, dtype, n_invocations=10):
mf = ift.MultiField.from_dict({}) mf = ift.MultiField.from_dict({})
ss = "ij->ji" ss = "ij->ji"
le = ift.LinearEinsum(dom, mf, ss) le = ift.LinearEinsum(dom, mf, ss)
assert_(check_linear_operator(le, domain_dtype=dtype, target_dtype=dtype) is None) ift.myassert(check_linear_operator(le, domain_dtype=dtype, target_dtype=dtype) is None)
# SwitchSpacesOperator is equivalent to LinearEinsum with "ij->ji" # SwitchSpacesOperator is equivalent to LinearEinsum with "ij->ji"
le_ift = _SwitchSpacesOperator(dom, 1) le_ift = _SwitchSpacesOperator(dom, 1)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import numpy as np import numpy as np
import pytest import pytest
from numpy.testing import assert_, assert_allclose from numpy.testing import assert_allclose
import nifty7 as ift import nifty7 as ift
...@@ -63,7 +63,7 @@ def test_fft1D(d, dtype, op): ...@@ -63,7 +63,7 @@ def test_fft1D(d, dtype, op):
@pmp('nthreads', [-1, 1, 2, 3, 4]) @pmp('nthreads', [-1, 1, 2, 3, 4])
def test_fft2D(dim1, dim2, d1, d2, dtype, op, nthreads): def test_fft2D(dim1, dim2, d1, d2, dtype, op, nthreads):
ift.fft.set_nthreads(nthreads) ift.fft.set_nthreads(nthreads)
assert_(ift.fft.nthreads() == nthreads) ift.myassert(ift.fft.nthreads() == nthreads)
tol = _get_rtol(dtype) tol = _get_rtol(dtype)
a = ift.RGSpace([dim1, dim2], distances=[d1, d2]) a = ift.RGSpace([dim1, dim2], distances=[d1, d2])
b = ift.RGSpace( b = ift.RGSpace(
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
import numpy as np import numpy as np
import pytest import pytest
from numpy.testing import assert_
import nifty7 as ift import nifty7 as ift
from ..common import setup_function, teardown_function from ..common import setup_function, teardown_function
pmp = pytest.mark.parametrize pmp = pytest.mark.parametrize
...@@ -57,7 +57,7 @@ def test_gridding(nu, nv, N, eps): ...@@ -57,7 +57,7 @@ def test_gridding(nu, nv, N, eps):
for i in range(N): for i in range(N):
dft += ( dft += (
vis[i]*np.exp(2j*np.pi*(x*uv[i, 0]*dstx + y*uv[i, 1]*dsty))).real vis[i]*np.exp(2j*np.pi*(x*uv[i, 0]*dstx + y*uv[i, 1]*dsty))).real
assert_(_l2error(dft, pynu) < eps) ift.myassert(_l2error(dft, pynu) < eps)
def test_cartesian(): def test_cartesian():
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import numpy as np import numpy as np
import pytest import pytest
from numpy.testing import assert_, assert_allclose from numpy.testing import assert_allclose
import nifty7 as ift import nifty7 as ift
...@@ -40,9 +40,9 @@ def test_part_mf_insert(): ...@@ -40,9 +40,9 @@ def test_part_mf_insert():
op = a.partial_insert(b) op = a.partial_insert(b)
fld = ift.from_random(op.domain, 'normal') fld = ift.from_random(op.domain, 'normal')
ift.extra.check_operator(op, fld, ntries=ntries) ift.extra.check_operator(op, fld, ntries=ntries)
assert_(op.domain is ift.MultiDomain.union( ift.myassert(op.domain is ift.MultiDomain.union(
[op1.domain, op2.domain, op4.domain, op5.domain])) [op1.domain, op2.domain, op4.domain, op5.domain]))
assert_(op.target is ift.MultiDomain.union( ift.myassert(op.target is ift.MultiDomain.union(
[op1.target, op2.target, op3.target, op5.target])) [op1.target, op2.target, op3.target, op5.target]))
x, y = fld.val, op(fld).val x, y = fld.val, op(fld).val
assert_allclose(y['a1'], x['a']*1.32) assert_allclose(y['a1'], x['a']*1.32)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# #
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik. # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
from numpy.testing import assert_, assert_allclose, assert_raises from numpy.testing import assert_allclose, assert_raises
import nifty7 as ift import nifty7 as ift
from nifty7.operators.simplify_for_const import ConstantOperator from nifty7.operators.simplify_for_const import ConstantOperator
...@@ -26,7 +26,7 @@ def test_simplification(): ...@@ -26,7 +26,7 @@ def test_simplification():
f1 = ift.full(dom, 2.) f1 = ift.full(dom, 2.)
op = ift.FFTOperator(f1.domain["a"]).ducktape("a") op = ift.FFTOperator(f1.domain["a"]).ducktape("a")
_, op2 = op.simplify_for_constant_input(f1) _, op2 = op.simplify_for_constant_input(f1)
assert_(isinstance(op2, ConstantOperator)) ift.myassert(isinstance(op2, ConstantOperator))
assert_allclose(op(f1).val, op2.force(f1).val) assert_allclose(op(f1).val, op2.force(f1).val)
dom = {"a": ift.RGSpace(10), "b": ift.RGSpace(5)} dom = {"a": ift.RGSpace(10), "b": ift.RGSpace(5)}
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
import numpy as np import numpy as np
import pytest import pytest
from numpy.testing import assert_
import nifty7 as ift import nifty7 as ift
from ..common import setup_function, teardown_function from ..common import setup_function, teardown_function
...@@ -38,5 +38,5 @@ def test_value_inserter(sp, seed): ...@@ -38,5 +38,5 @@ def test_value_inserter(sp, seed):
f = ift.from_random(op.domain, 'normal') f = ift.from_random(op.domain, 'normal')
inp = f.val inp = f.val
ret = op(f).val ret = op(f).val
assert_(ret[ind] == inp) ift.myassert(ret[ind] == inp)
assert_(np.sum(ret) == inp) ift.myassert(np.sum(ret) == inp)
...@@ -19,10 +19,10 @@ import itertools ...@@ -19,10 +19,10 @@ import itertools
import numpy as np import numpy as np
import pytest import pytest
from numpy.testing import (assert_, assert_almost_equal, assert_equal, from numpy.testing import assert_almost_equal, assert_equal, assert_raises
assert_raises)
from nifty7 import GLSpace, myassert
from nifty7 import GLSpace
from ..common import setup_function, teardown_function from ..common import setup_function, teardown_function
pmp = pytest.mark.parametrize pmp = pytest.mark.parametrize
...@@ -56,7 +56,7 @@ def get_dvol_configs(): ...@@ -56,7 +56,7 @@ def get_dvol_configs():
@pmp('attribute', ['nlat', 'nlon']) @pmp('attribute', ['nlat', 'nlon'])
def test_property_ret_type(attribute): def test_property_ret_type(attribute):
g = GLSpace(2) g = GLSpace(2)
assert_(isinstance(getattr(g, attribute), int)) myassert(isinstance(getattr(g, attribute), int))
@pmp('nlat, nlon, expected', CONSTRUCTOR_CONFIGS) @pmp('nlat, nlon, expected', CONSTRUCTOR_CONFIGS)
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
import numpy as np import numpy as np
import pytest import pytest
from numpy.testing import (assert_, assert_almost_equal, assert_equal, from numpy.testing import assert_almost_equal, assert_equal, assert_raises
assert_raises)
from nifty7 import HPSpace, myassert
from nifty7 import HPSpace
from ..common import setup_function, teardown_function from ..common import setup_function, teardown_function
pmp = pytest.mark.parametrize pmp = pytest.mark.parametrize
...@@ -49,7 +49,7 @@ CONSTRUCTOR_CONFIGS = [[ ...@@ -49,7 +49,7 @@ CONSTRUCTOR_CONFIGS = [[
def test_property_ret_type(): def test_property_ret_type():
x = HPSpace(2) x = HPSpace(2)
assert_(isinstance(getattr(x, 'nside'), int)) myassert(isinstance(getattr(x, 'nside'), int))
@pmp('nside, expected', CONSTRUCTOR_CONFIGS) @pmp('nside, expected', CONSTRUCTOR_CONFIGS)
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
from types import LambdaType from types import LambdaType
import pytest import pytest
from numpy.testing import assert_
import nifty7 as ift import nifty7 as ift
from ..common import setup_function, teardown_function from ..common import setup_function, teardown_function
pmp = pytest.mark.parametrize pmp = pytest.mark.parametrize
...@@ -36,7 +36,7 @@ pmp = pytest.mark.parametrize ...@@ -36,7 +36,7 @@ pmp = pytest.mark.parametrize
ift.GLSpace(4) ift.GLSpace(4)
]) ])
def test_property_ret_type(space, attr_expected_type): def test_property_ret_type(space, attr_expected_type):
assert_( ift.myassert(
isinstance( isinstance(
getattr(space, attr_expected_type[0]), attr_expected_type[1])) getattr(space, attr_expected_type[0]), attr_expected_type[1]))
...@@ -46,7 +46,7 @@ def test_property_ret_type(space, attr_expected_type): ...@@ -46,7 +46,7 @@ def test_property_ret_type(space, attr_expected_type):
['get_fft_smoothing_kernel_function', 2.0, LambdaType]]) ['get_fft_smoothing_kernel_function', 2.0, LambdaType]])
@pmp('space', [ift.RGSpace(4, harmonic=True), ift.LMSpace(5)]) @pmp('space', [ift.RGSpace(4, harmonic=True), ift.LMSpace(5)])
def test_method_ret_type(space, method_expected_type): def test_method_ret_type(space, method_expected_type):
assert_( ift.myassert(
type( type(
getattr(space, method_expected_type[0]) getattr(space, method_expected_type[0])
(*method_expected_type[1:-1])) is method_expected_type[-1]) (*method_expected_type[1:-1])) is method_expected_type[-1])
...@@ -17,9 +17,10 @@ ...@@ -17,9 +17,10 @@
import numpy as np import numpy as np
import pytest import pytest
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises from numpy.testing import assert_allclose, assert_equal, assert_raises
import nifty7 as ift import nifty7 as ift