From 08424555f82bad0831e4ffad6cac68950512be8e Mon Sep 17 00:00:00 2001 From: Ben Connors Date: Sun, 29 Sep 2019 17:58:03 -0400 Subject: Some fixes - Remove print statements - Fix chaser scope and rendering --- tests/test_functions_audio.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/test_functions_audio.py') 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 = [ + """""", + """""", + """""", + """""", + """""", + ] + + for case in fail: + case = case.format('"'+BXW.strip("{}")+'"') + with pytest.raises(LoadError): + Audio.deserialize(aws, et.fromstring(case)) + + case = """""" + case = case.format('"'+BXW.strip("{}")+'"') + + s = Audio.deserialize(aws, et.fromstring(case)) + + assert test_xml_eq(s.serialize(), case) -- cgit v1.2.3