diff options
author | Ben Connors <benconnors@outlook.com> | 2019-09-29 17:58:03 -0400 |
---|---|---|
committer | Ben Connors <benconnors@outlook.com> | 2019-09-29 17:58:19 -0400 |
commit | 08424555f82bad0831e4ffad6cac68950512be8e (patch) | |
tree | c9f59407e87a7e0b8f5b41df439f7120e6044205 /tests/test_functions_audio.py | |
parent | 2255278b0e81fc20faff48536f524e1466046c8a (diff) |
Some fixes
- Remove print statements
- Fix chaser scope and rendering
Diffstat (limited to 'tests/test_functions_audio.py')
-rw-r--r-- | tests/test_functions_audio.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_functions_audio.py b/tests/test_functions_audio.py index 5aaec5a..b6e6c6a 100644 --- a/tests/test_functions_audio.py +++ b/tests/test_functions_audio.py @@ -1,9 +1,12 @@ """Tests for the audio primitive.""" +import xml.etree.ElementTree as et + import pytest from blc2.functions.audio import Audio from blc2.constants import BXW +from blc2.exceptions import LoadError def test_audio(aws): a = Audio(aws) @@ -76,3 +79,24 @@ def test_audio_serialize(aws, test_xml_eq): for case, s in zip(test, success): s = s.replace('\n', "").format(BXW.strip("{}")) assert test_xml_eq(case.serialize(), s) + +def test_audio_deserialize(aws, test_xml_eq): + fail = [ + """<function xmlns={} type="asdf"/>""", + """<asdf/>""", + """<function xmlns={} type="Audio" id="asdf"/>""", + """<function xmlns={} type="Audio" id="123" name="Test Audio" fade-out="asdf"/>""", + """<function xmlns={} type="Audio" id="123" name="Test Audio" fade-in="asdf"/>""", + ] + + for case in fail: + case = case.format('"'+BXW.strip("{}")+'"') + with pytest.raises(LoadError): + Audio.deserialize(aws, et.fromstring(case)) + + case = """<function xmlns={} type="Audio" id="123" name="Test Audio" fade-in="123" fade-out="321" filename="test.wav"/>""" + case = case.format('"'+BXW.strip("{}")+'"') + + s = Audio.deserialize(aws, et.fromstring(case)) + + assert test_xml_eq(s.serialize(), case) |