Add more unit tests
Little naming cleanup (first round)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from . import (boolean_nodes, casting_nodes, comparison_nodes, control_flow,
|
||||
from . import (boolean_nodes, casting_nodes, comparison_nodes, control_flow_nodes,
|
||||
data_list_nodes, dict_nodes, float_nodes, int_nodes, list_nodes,
|
||||
math_nodes, path_nodes, regex_nodes, set_nodes, string_nodes)
|
||||
|
||||
@@ -6,7 +6,7 @@ NODE_CLASS_MAPPINGS = {}
|
||||
NODE_CLASS_MAPPINGS.update(boolean_nodes.NODE_CLASS_MAPPINGS)
|
||||
NODE_CLASS_MAPPINGS.update(casting_nodes.NODE_CLASS_MAPPINGS)
|
||||
NODE_CLASS_MAPPINGS.update(comparison_nodes.NODE_CLASS_MAPPINGS)
|
||||
NODE_CLASS_MAPPINGS.update(control_flow.NODE_CLASS_MAPPINGS)
|
||||
NODE_CLASS_MAPPINGS.update(control_flow_nodes.NODE_CLASS_MAPPINGS)
|
||||
NODE_CLASS_MAPPINGS.update(data_list_nodes.NODE_CLASS_MAPPINGS)
|
||||
NODE_CLASS_MAPPINGS.update(dict_nodes.NODE_CLASS_MAPPINGS)
|
||||
NODE_CLASS_MAPPINGS.update(float_nodes.NODE_CLASS_MAPPINGS)
|
||||
@@ -22,7 +22,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {}
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(boolean_nodes.NODE_DISPLAY_NAME_MAPPINGS)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(casting_nodes.NODE_DISPLAY_NAME_MAPPINGS)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(comparison_nodes.NODE_DISPLAY_NAME_MAPPINGS)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(control_flow.NODE_DISPLAY_NAME_MAPPINGS)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(control_flow_nodes.NODE_DISPLAY_NAME_MAPPINGS)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(data_list_nodes.NODE_DISPLAY_NAME_MAPPINGS)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(dict_nodes.NODE_DISPLAY_NAME_MAPPINGS)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(float_nodes.NODE_DISPLAY_NAME_MAPPINGS)
|
||||
|
||||
@@ -51,7 +51,7 @@ class CastToInt:
|
||||
def convert_to_int(self, input: Any) -> tuple[int]:
|
||||
try:
|
||||
return (int(input),)
|
||||
except ValueError:
|
||||
except (ValueError, TypeError):
|
||||
raise ValueError(f"Cannot convert {input} to an INT.")
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class CastToFloat:
|
||||
def convert_to_float(self, input: Any) -> tuple[float]:
|
||||
try:
|
||||
return (float(input),)
|
||||
except ValueError:
|
||||
except (ValueError, TypeError):
|
||||
raise ValueError(f"Cannot convert {input} to a FLOAT.")
|
||||
|
||||
|
||||
|
||||
@@ -481,7 +481,7 @@ class DataListGetItem:
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"input_list": ("*",),
|
||||
"list": ("*",),
|
||||
"index": ("INT", {"default": 0}),
|
||||
}
|
||||
}
|
||||
@@ -557,7 +557,7 @@ class DataListContains:
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"input_list": ("*",),
|
||||
"list": ("*",),
|
||||
"value": ("*",),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class StringCenter:
|
||||
return (string.center(width, fillchar),)
|
||||
|
||||
|
||||
class StringConcat:
|
||||
class DataStringConcat:
|
||||
"""Combines two text strings together, joining them end-to-end."""
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
@@ -1771,7 +1771,7 @@ NODE_CLASS_MAPPINGS = {
|
||||
"StringCapitalize": StringCapitalize,
|
||||
"StringCasefold": StringCasefold,
|
||||
"StringCenter": StringCenter,
|
||||
"StringConcat": StringConcat,
|
||||
"DataStringConcat": DataStringConcat,
|
||||
"StringCount": StringCount,
|
||||
"StringDecode": StringDecode,
|
||||
"StringEncode": StringEncode,
|
||||
@@ -1816,7 +1816,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"StringCapitalize": "capitalize",
|
||||
"StringCasefold": "casefold",
|
||||
"StringCenter": "center",
|
||||
"StringConcat": "concat",
|
||||
"DataStringConcat": "concat",
|
||||
"StringCount": "count",
|
||||
"StringDecode": "decode",
|
||||
"StringEncode": "encode",
|
||||
|
||||
Reference in New Issue
Block a user