Skip to content

πŸŽ› πŸ”Š A Python library for audio.

Add check for empty name_chars list when normalizing param names (#331)

ryansdavis273eb538193b
diff --git a/pedalboard/_pedalboard.py b/pedalboard/_pedalboard.py
index 91c0a87..bcd9d66 100644
--- a/pedalboard/_pedalboard.py
+++ b/pedalboard/_pedalboard.py
@@ -608,6 +608,8 @@ def normalize_python_parameter_name(name: str) -> str:
c if (c.isalpha() or c.isnumeric()) and c.isprintable() and ord(c) < 128 else "_"
for c in name
]
+ if not name_chars: # Unhandled/Weird param name
+ return ""
# Remove any double-underscores:
name_chars = [a for a, b in zip(name_chars, name_chars[1:]) if a != b or b != "_"] + [
name_chars[-1]
diff --git a/tests/test_external_plugins.py b/tests/test_external_plugins.py
index 5a65dbe..e54836f 100644
--- a/tests/test_external_plugins.py
+++ b/tests/test_external_plugins.py
@@ -898,6 +898,8 @@ def test_wrapped_bool_requires_bool():
("Bβ™­", "b_flat"),
("Azimuth (ΒΊ)", "azimuth"),
("Normal String", "normal_string"),
+ ("", ""),
+ ("Ξ”", ""),
],
)
def test_parameter_name_normalization(_input: str, expected: str):