Browse Source

Fix failing checker AGAIN: property type checker when the type is a class.

jean-robin medori 3 months ago
parent
commit
65828fc1cd
1 changed files with 10 additions and 9 deletions
  1. 10 9
      taipy/core/config/checkers/_data_node_config_checker.py

+ 10 - 9
taipy/core/config/checkers/_data_node_config_checker.py

@@ -218,21 +218,22 @@ class _DataNodeConfigChecker(_ConfigChecker):
                 prop_value = data_node_config.properties.get(prop_key) if data_node_config.properties else None
 
                 if prop_value:
-                    if isclass(prop_type) and isclass(prop_value) and not issubclass(prop_value, prop_type):
-                        self._error(
-                            prop_key,
-                            prop_value,
-                            f"`{prop_key}` of DataNodeConfig `{data_node_config_id}` must be"
-                            f" populated with a subclass of {prop_type}.",
-                        )
-                    if not isinstance(prop_value, prop_type):
+                    if isclass(prop_type) and isclass(prop_value):
+                        if not issubclass(prop_value, prop_type):
+                            self._error(
+                                prop_key,
+                                prop_value,
+                                f"`{prop_key}` of DataNodeConfig `{data_node_config_id}` must be"
+                                f" populated with a subclass of {prop_type}.",
+                            )
+                    elif not isinstance(prop_value, prop_type):
                         self._error(
                             prop_key,
                             prop_value,
                             f"`{prop_key}` of DataNodeConfig `{data_node_config_id}` must be"
                             f" populated with a {prop_type}.",
                         )
-                    if prop_type == Callable and callable(prop_value) and prop_value.__name__ == "<lambda>":
+                    elif prop_type == Callable and callable(prop_value) and prop_value.__name__ == "<lambda>":
                         self._error(
                             prop_key,
                             prop_value,