summaryrefslogtreecommitdiff
path: root/tests/test_functions_audio.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_functions_audio.py')
-rw-r--r--tests/test_functions_audio.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/test_functions_audio.py b/tests/test_functions_audio.py
index de6aa2a..35d548a 100644
--- a/tests/test_functions_audio.py
+++ b/tests/test_functions_audio.py
@@ -1,4 +1,6 @@
-import os
+"""Tests for the audio primitive."""
+
+import pytest
from blc2.functions.audio import Audio
@@ -15,6 +17,7 @@ def test_audio(aws):
assert a.actual_duration == 0
a.filename = "tests/silence.m4a"
+ assert a.filename == "tests/silence.m4a"
assert a.audio_scope == {"tests/silence.m4a"}
assert a.duration == 2024
assert a.actual_duration == 3024
@@ -34,3 +37,25 @@ def test_audio(aws):
_, ac, _ = a.render(5000)
assert not ac
+
+ with pytest.raises(ValueError):
+ _ = Audio(aws, id_=101, fade_in=-10)
+
+ assert 101 not in aws.functions
+
+ fout = a.fade_out
+ with pytest.raises(ValueError):
+ a.fade_out = -50
+ assert a.fade_out == fout
+
+ fin = a.fade_in
+ with pytest.raises(ValueError):
+ a.fade_in = -50
+ assert a.fade_in == fin
+
+ a._set_duration(10000)
+ assert a.copy_data(a.get_data()) is None
+
+ a.filename = None
+ assert a.duration == 0
+ assert a.actual_duration == 0