diff --git a/taipy/core/config/checkers/_data_node_config_checker.py b/taipy/core/config/checkers/_data_node_config_checker.py index 0abe78153..a15291198 100644 --- a/taipy/core/config/checkers/_data_node_config_checker.py +++ b/taipy/core/config/checkers/_data_node_config_checker.py @@ -227,7 +227,14 @@ def _check_class_type(self, data_node_config_id: str, data_node_config: DataNode prop_key, prop_value, f"`{prop_key}` of DataNodeConfig `{data_node_config_id}` must be" - f" populated with a {class_type.__qualname__}.", + f" populated with a {'Callable' if class_type == Callable else class_type.__name__}.", + ) + if class_type == Callable and callable(prop_value) and prop_value.__name__ == "": + self._error( + prop_key, + prop_value, + f"`{prop_key}` of DataNodeConfig `{data_node_config_id}` must be" + f" populated with a Callable and not a lambda.", ) def _check_exposed_type(self, data_node_config_id: str, data_node_config: DataNodeConfig): diff --git a/tests/core/config/checkers/test_data_node_config_checker.py b/tests/core/config/checkers/test_data_node_config_checker.py index ca75449c0..32f0ba81b 100644 --- a/tests/core/config/checkers/test_data_node_config_checker.py +++ b/tests/core/config/checkers/test_data_node_config_checker.py @@ -581,6 +581,22 @@ def test_check_callable_properties(self, caplog): Config.check() assert len(Config._collector.errors) == 0 + config._sections[DataNodeConfig.name]["new"].storage_type = "generic" + config._sections[DataNodeConfig.name]["new"].properties = {"write_fct": lambda x: x, "read_fct": lambda y: y} + with pytest.raises(SystemExit): + Config._collector = IssueCollector() + Config.check() + assert len(Config._collector.errors) == 2 + expected_error_messages = [ + "`write_fct` of DataNodeConfig `new` must be populated with a Callable and not a lambda." + " Current value of property `write_fct` is .", + "`read_fct` of DataNodeConfig `new` must be populated with a Callable and not a lambda." + " Current value of property `read_fct` is .", + ] + assert all(message in caplog.text for message in expected_error_messages) + def test_check_read_write_fct_args(self, caplog): config = Config._applied_config Config._compile_configs()