π π A Python library for audio.
C audioaudio-processingaudio-productionaudio-researchaudio-unitaugmentationjucemachine-learningpybind11pythonvst3vst3-host
fix: looks_like_float random falses (#38)
Carlos Torres1b620e5b3375
diff --git a/pedalboard/pedalboard.py b/pedalboard/pedalboard.pyindex 0e184cf..d2c2dbf 100644--- a/pedalboard/pedalboard.py+++ b/pedalboard/pedalboard.py@@ -144,10 +144,10 @@ FLOAT_SUFFIXES_TO_IGNORE = set(["x", "%", "*", ",", ".", "hz"])def strip_common_float_suffixes(s: str) -> str:- value = s.lower()+ value = s.lower().strip()for suffix in FLOAT_SUFFIXES_TO_IGNORE:- if suffix in value:- value = value[: -len(suffix)]+ if value[-len(suffix) :] == suffix:+ value = value[: -len(suffix)].strip()return valuediff --git a/tests/test_external_plugins.py b/tests/test_external_plugins.pyindex 3d1b45e..1b3fdeb 100644--- a/tests/test_external_plugins.py+++ b/tests/test_external_plugins.py@@ -21,7 +21,7 @@ import randomimport platformfrom glob import glob-from pedalboard.pedalboard import WrappedBool+from pedalboard.pedalboard import WrappedBool, strip_common_float_suffixesimport pytestimport pedalboardimport numpy as np@@ -106,6 +106,21 @@ def test_at_least_one_plugin_is_available_for_testing():assert AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT+ "value,expected",+ [+ ("nope", "nope"),+ ("10.5x", "10.5"),+ ("12%", "12"),+ ("123 Hz", "123"),+ ("123.45 Hz", "123.45"),+ ],+)+def test_strip_common_float_suffixes(value, expected):+ actual = strip_common_float_suffixes(value)+ assert actual == expected++@pytest.mark.parametrize("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)def test_at_least_one_parameter(plugin_filename: str):"""