示例#1
0
 def testRemoveInvalidControlCharactersWorksOnNonUnicodeStrings( self ):
     handler = xml.sax.handler.ContentHandler()
     for char in xml_tools.INVALID_CONTROL_CHARACTERS:
         xmlStr = "<test>%s</test>" % chr( char )
         xmlStr = xml_tools.remove_invalid_control_chars( xmlStr )
         self.assertEquals( xmlStr, "<test></test>" )
         xml.sax.parseString( xmlStr, handler )
示例#2
0
 def testRemoveInvalidControlCharactersWorksOnNonUnicodeStrings( self ):
     handler = xml.sax.handler.ContentHandler()
     for char in xml_tools.INVALID_CONTROL_CHARACTERS:
         xmlStr = "<test>%s</test>" % chr( char )
         xmlStr = xml_tools.remove_invalid_control_chars( xmlStr )
         self.assertEquals( xmlStr, "<test></test>" )
         xml.sax.parseString( xmlStr, handler )
示例#3
0
 def testRemoveInvalidControlCharactersWorksOnUnicodeStrings( self ):
     handler = xml.sax.handler.ContentHandler()
     for char in xml_tools.INVALID_CONTROL_CHARACTERS:
         xmlStr = u"<test>%s\u2026</test>" % chr( char )
         xmlStr = xml_tools.remove_invalid_control_chars( xmlStr )
         self.assertEquals( xmlStr, u"<test>\u2026</test>" )
         xmlStr = xmlStr.encode( "ascii", "xmlcharrefreplace" )
         xml.sax.parseString( xmlStr, handler )
示例#4
0
 def testRemoveInvalidControlCharactersWorksOnUnicodeStrings( self ):
     handler = xml.sax.handler.ContentHandler()
     for char in xml_tools.INVALID_CONTROL_CHARACTERS:
         xmlStr = u"<test>%s\u2026</test>" % chr( char )
         xmlStr = xml_tools.remove_invalid_control_chars( xmlStr )
         self.assertEquals( xmlStr, u"<test>\u2026</test>" )
         xmlStr = xmlStr.encode( "ascii", "xmlcharrefreplace" )
         xml.sax.parseString( xmlStr, handler )