Merge pull request #52 from Comahar/fix/string-list-join-sep
Fix StringListJoin separator handling
This commit is contained in:
@@ -752,8 +752,7 @@ class StringListJoin(ComfyNodeABC):
|
||||
FUNCTION = "join"
|
||||
|
||||
def join(self, sep, strings):
|
||||
separator = sep[0] # everything comes as a list, so sep is list[str]
|
||||
return (separator.join(strings),)
|
||||
return (sep.join(strings),)
|
||||
|
||||
|
||||
class StringLjust(ComfyNodeABC):
|
||||
|
||||
@@ -226,9 +226,9 @@ def test_join():
|
||||
|
||||
# Test ListJoin variant
|
||||
node_list = StringListJoin()
|
||||
assert node_list.join([", "], ["apple", "banana", "cherry"]) == ("apple, banana, cherry",)
|
||||
assert node_list.join([""], ["a", "b", "c"]) == ("abc",)
|
||||
assert node_list.join(["-"], []) == ("",) # Empty list
|
||||
assert node_list.join(", ", ["apple", "banana", "cherry"]) == ("apple, banana, cherry",)
|
||||
assert node_list.join("", ["a", "b", "c"]) == ("abc",)
|
||||
assert node_list.join("-", []) == ("",) # Empty list
|
||||
|
||||
def test_ljust():
|
||||
node = StringLjust()
|
||||
|
||||
Reference in New Issue
Block a user