Ejemplo n.º 1
0
 def test_escape_override_entities(self):
     expected = '<hello>T&blah;was a dark & "stormy" night</hello>'
     input = '<hello>T\'was a dark & "stormy" night</hello>'
     self.assertEquals(expected, codec_xml.escape(input, {"'": "&blah;"}))
Ejemplo n.º 2
0
 def test_escape(self):
     expected = '&lt;hello&gt;T&apos;was a dark &amp; &quot;stormy&quot; night&lt;/hello&gt;'
     input = '<hello>T\'was a dark & "stormy" night</hello>'
     self.assertEquals(expected, codec_xml.escape(input))
Ejemplo n.º 3
0
 def test_escape_additional_entities(self):
     expected = '&lt;hello&gt;T&apos;was&nbsp;a&nbsp;dark&nbsp;&amp;&nbsp;&quot;stormy&quot;&nbsp;night&lt;/hello&gt;'
     input = '<hello>T\'was a dark & "stormy" night</hello>'
     self.assertEquals(expected, codec_xml.escape(input, {' ': '&nbsp;'}))