diff --git a/test/test_init.py b/test/test_init.py deleted file mode 100644 index 432bbfd98cd717e56d16f5d3dbb1f51db9a419e1..0000000000000000000000000000000000000000 --- a/test/test_init.py +++ /dev/null @@ -1,5 +0,0 @@ -from nifty2go import * - -# This tests if it is possible to import all of Nifty's methods. -# Experience shows this is not always possible. -pass diff --git a/test/test_operators/test_composed_operator.py b/test/test_operators/test_composed_operator.py index 2e3d540cd922b5642b435e95e1adf25da47c15ee..1a4890879c9809c83062616794cd5906ab6201df 100644 --- a/test/test_operators/test_composed_operator.py +++ b/test/test_operators/test_composed_operator.py @@ -61,3 +61,13 @@ class ComposedOperator_Tests(unittest.TestCase): res = full_op(x) assert_equal(isinstance(full_op, ift.DiagonalOperator), True) assert_allclose(ift.dobj.to_global_data(res.val), 432.) + + @expand(product(spaces)) + def test_mix(self, space): + op1 = ift.DiagonalOperator(ift.Field(space, 2.)) + op2 = ift.ScalingOperator(3., space) + full_op = op1 * (op2 + op2) * op1 * op1 - op1 * op2 + x = ift.Field(space, 1.) + res = full_op(x) + assert_equal(isinstance(full_op, ift.DiagonalOperator), True) + assert_allclose(ift.dobj.to_global_data(res.val), 42.) diff --git a/test/test_spaces/test_interface.py b/test/test_spaces/test_interface.py index 59cd32b9ac2df3f22ae22e21cd013747d94a61a7..eda89acce7d6de1cfe53c965b9b932b7f9648efc 100644 --- a/test/test_spaces/test_interface.py +++ b/test/test_spaces/test_interface.py @@ -21,7 +21,7 @@ from numpy.testing import assert_ from itertools import product from types import LambdaType from test.common import expand, generate_spaces, generate_harmonic_spaces -from nifty2go import * # ugly, but needed for the eval() below +import nifty2go as ift class SpaceInterfaceTests(unittest.TestCase): @@ -34,14 +34,10 @@ class SpaceInterfaceTests(unittest.TestCase): attr_expected_type[1])) @expand(product(generate_harmonic_spaces(), [ - ['get_k_length_array', Field], + ['get_k_length_array', ift.Field], ['get_fft_smoothing_kernel_function', 2.0, LambdaType], ])) def test_method_ret_type(self, space, method_expected_type): assert_(type(getattr(space, method_expected_type[0])( *method_expected_type[1:-1])) is method_expected_type[-1]) - - @expand([[space] for space in generate_spaces()]) - def test_repr(self, space): - assert_(space == eval(space.__repr__()))