Commit b7e0e994 authored by Theo Steininger's avatar Theo Steininger
Browse files

Small modifications to and test/

parent 383d0a19
Pipeline #9611 failed with stage
in 28 minutes and 43 seconds
...@@ -7,5 +7,7 @@ def custom_name_func(testcase_func, param_num, param): ...@@ -7,5 +7,7 @@ def custom_name_func(testcase_func, param_num, param):
parameterized.to_safe_name("_".join(str(x) for x in param.args)), parameterized.to_safe_name("_".join(str(x) for x in param.args)),
) )
expand = lambda z: parameterized.expand(z,
testcase_func_name=custom_name_func) def expand(*args, **kwargs):
return parameterized.expand(*args, testcase_func_name=custom_name_func,
...@@ -6,7 +6,7 @@ import numpy as np ...@@ -6,7 +6,7 @@ import numpy as np
from numpy.testing import assert_,\ from numpy.testing import assert_,\
assert_equal assert_equal
import itertools from itertools import product
from nifty import Field,\ from nifty import Field,\
RGSpace,\ RGSpace,\
...@@ -24,21 +24,23 @@ SPACE_COMBINATIONS = [SPACES[0], SPACES[1], SPACES] ...@@ -24,21 +24,23 @@ SPACE_COMBINATIONS = [SPACES[0], SPACES[1], SPACES]
class Test_Interface(unittest.TestCase): class Test_Interface(unittest.TestCase):
@expand([['dtype', np.dtype], @expand(product(SPACE_COMBINATIONS,
['distribution_strategy', str], [['dtype', np.dtype],
['domain', tuple], ['distribution_strategy', str],
['field_type', tuple], ['domain', tuple],
['domain_axes', tuple], ['field_type', tuple],
['field_type_axes', tuple], ['domain_axes', tuple],
['val', distributed_data_object], ['field_type_axes', tuple],
['shape', tuple], ['val', distributed_data_object],
['dim',], ['shape', tuple],
['dof',], ['dim',],
['total_volume', np.float]]) ['dof',],
def test_return_types(self, attribute, desired_type): ['total_volume', np.float]]))
x = RGSpace(shape=(4,)) def test_return_types(self, domain, attribute_desired_type):
attribute = attribute_desired_type[0]
desired_type = attribute_desired_type[1]
ft = FieldArray(shape=(2,), dtype=np.complex) ft = FieldArray(shape=(2,), dtype=np.complex)
f = Field(domain=x, field_type=ft) f = Field(domain=domain, field_type=ft)
assert_(isinstance(getattr(f, attribute), desired_type)) assert_(isinstance(getattr(f, attribute), desired_type))
#class Test_Initialization(unittest.TestCase): #class Test_Initialization(unittest.TestCase):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment