Skip to content

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

Fix test_repr.

Peter Sobot54f0129d403f
diff --git a/pedalboard/pedalboard.py b/pedalboard/pedalboard.py
index c231ad7..67e0e7d 100644
--- a/pedalboard/pedalboard.py
+++ b/pedalboard/pedalboard.py
@@ -33,7 +33,12 @@ class Pedalboard(Chain):
super().__init__(plugins or [])
def __repr__(self) -> str:
- return "<{} with {} plugins: {}>".format(self.__class__.__name__, len(self), list(self))
+ return "<{} with {} plugin{}: {}>".format(
+ self.__class__.__name__,
+ len(self),
+ "" if len(self) == 1 else "s",
+ list(self),
+ )
FLOAT_SUFFIXES_TO_IGNORE = set(["x", "%", "*", ",", ".", "hz"])
diff --git a/tests/test_python_interface.py b/tests/test_python_interface.py
index 807fc9c..1cbecf1 100644
--- a/tests/test_python_interface.py
+++ b/tests/test_python_interface.py
@@ -50,9 +50,17 @@ def test_repr():
value = repr(Pedalboard([gain]))
# Allow flexibility; all we care about is that these values exist in the repr.
assert "Pedalboard" in value
- assert "plugins=" in value
+ assert " 1 " in value
assert repr(gain) in value
+ gain2 = Gain(-6)
+ value = repr(Pedalboard([gain, gain2]))
+ # Allow flexibility; all we care about is that these values exist in the repr.
+ assert "Pedalboard" in value
+ assert " 2 " in value
+ assert repr(gain) in value
+ assert repr(gain2) in value
+
def test_is_list_like():
gain = Gain(-6)