From d610850a3d4188e91306cb7b1c93b76994d05375 Mon Sep 17 00:00:00 2001 From: Markus Holzer <markus.holzer@fau.de> Date: Tue, 25 Oct 2022 10:33:26 +0200 Subject: [PATCH] clean up --- pystencils/config.py | 2 ++ pystencils_tests/test_config.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/pystencils/config.py b/pystencils/config.py index d38876bc..9ef7b62d 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 9824113b..31f6f9ec 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) -- GitLab