def test_attrEscaping(self): """Test that attribute values are escaped. Depends on behavior tested in test_standAloneTagNoContent. """ xml = self.balancer.generateXml([ speechXml.StandAloneTagCommand("tag", {"attr": '"v1"&"v2"'}, None) ]) self.assertEqual(xml, '<tag attr=""v1"&"v2""/>')
def test_EncloseText(self): """Depends on behavior tested in test_standAloneTagNoContent. """ xml = self.balancer.generateXml([ speechXml.EncloseTextCommand("say-as", {"interpret-as": "characters"}), speechXml.StandAloneTagCommand("mark", {"name": "1"}, None), "c" ]) self.assertEqual( xml, '<mark name="1"/><say-as interpret-as="characters">c</say-as>')
def test_encloseAll(self): """Depends on behavior tested by test_standAloneTag. """ xml = self.balancer.generateXml([ speechXml.EncloseAllCommand("encloseAll", {"attr": "val"}), speechXml.StandAloneTagCommand("standAlone", {}, "content") ]) self.assertEqual( xml, '<encloseAll attr="val"><standAlone>content</standAlone></encloseAll>' )
def test_standAloneTag(self): xml = self.balancer.generateXml([ speechXml.StandAloneTagCommand("tag", {"attr": "val"}, "content") ]) self.assertEqual(xml, '<tag attr="val">content</tag>')
def test_standAloneTagNoContent(self): xml = self.balancer.generateXml( [speechXml.StandAloneTagCommand("tag", {"attr": "val"}, None)]) self.assertEqual(xml, '<tag attr="val"/>')