Пример #1
0
    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="&quot;v1&quot;&amp;&quot;v2&quot;"/>')
Пример #2
0
    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>')
Пример #3
0
    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>'
        )
Пример #4
0
 def test_standAloneTag(self):
     xml = self.balancer.generateXml([
         speechXml.StandAloneTagCommand("tag", {"attr": "val"}, "content")
     ])
     self.assertEqual(xml, '<tag attr="val">content</tag>')
Пример #5
0
 def test_standAloneTagNoContent(self):
     xml = self.balancer.generateXml(
         [speechXml.StandAloneTagCommand("tag", {"attr": "val"}, None)])
     self.assertEqual(xml, '<tag attr="val"/>')