diff --git a/pystencils/config.py b/pystencils/config.py index d38876bc141d7da0aa50a48e40f916247b729b5a..9ef7b62dda30595b725a05e11bcd935d30415507 100644 --- a/pystencils/config.py +++ b/pystencils/config.py @@ -186,6 +186,8 @@ class CreateKernelConfig: self.data_type = defaultdict(self.DataTypeFactory(dt), dtype_dict) assert isinstance(self.data_type, defaultdict), "At this point data_type must be a defaultdict!" + for dtype in self.data_type.values(): + self._check_type(dtype) self._check_type(self.data_type.default_factory()) if self.default_number_float is None: diff --git a/pystencils_tests/test_config.py b/pystencils_tests/test_config.py index 9824113bab56bfaeed557529fa3ad61e8577ea3a..31f6f9ec983227a3166e556958aac822e0531cfc 100644 --- a/pystencils_tests/test_config.py +++ b/pystencils_tests/test_config.py @@ -100,3 +100,15 @@ def test_config_python_types8(): dtype = defaultdict(lambda: float, {'a': np.float64, 'b': np.int64}) with pytest.raises(ValueError): CreateKernelConfig(data_type=dtype) + + +def test_config_python_types9(): + dtype = defaultdict(lambda: 'float32', {'a': 'float', 'b': np.int64}) + with pytest.raises(ValueError): + CreateKernelConfig(data_type=dtype) + + +def test_config_python_types10(): + dtype = defaultdict(lambda: 'float32', {'a': float, 'b': np.int64}) + with pytest.raises(ValueError): + CreateKernelConfig(data_type=dtype)