Beispiel #1
0
    def testWierdCases( self ):
        for case in self.TESTS:
            xml_data = case
            innerText = "abcdefghijklmnopqrstuvwxyz"

        document = xml.dom.minidom.parseString( xml_data )

        results = xml_tools.get_inner_text( document )
        self.failUnlessEqual( results, innerText )
Beispiel #2
0
    def testWierdCases( self ):
        for case in self.TESTS:
            xml_data = case
            innerText = "abcdefghijklmnopqrstuvwxyz"

        document = xml.dom.minidom.parseString( xml_data )

        results = xml_tools.get_inner_text( document )
        self.failUnlessEqual( results, innerText )
Beispiel #3
0
    def testManyTags( self ):

        cases = range( ord("a"), ord("z") )
        cases = [ chr( c ) for c in cases ]

        xml_data = "<xml>\n"
        for c in cases:
            xml_data += ( "  <%s>%s</%s>\n" % ( c, c.upper(), c ) )
        xml_data += "</xml>"

        document = xml.dom.minidom.parseString( xml_data )

        for c in cases:
            nodes = document.getElementsByTagName( c )
            # There should be only one dom node for each tag name.
            self.failUnlessEqual( len(nodes), 1 )
            # The inner xml should be exactly the tag name, uppercased.
            results = xml_tools.get_inner_text( nodes[0] )
            self.failUnlessEqual( results, c.upper() )
Beispiel #4
0
    def testManyTags( self ):

        cases = range( ord("a"), ord("z") )
        cases = [ chr( c ) for c in cases ]

        xml_data = "<xml>\n"
        for c in cases:
            xml_data += ( "  <%s>%s</%s>\n" % ( c, c.upper(), c ) )
        xml_data += "</xml>"

        document = xml.dom.minidom.parseString( xml_data )

        for c in cases:
            nodes = document.getElementsByTagName( c )
            # There should be only one dom node for each tag name.
            self.failUnlessEqual( len(nodes), 1 )
            # The inner xml should be exactly the tag name, uppercased.
            results = xml_tools.get_inner_text( nodes[0] )
            self.failUnlessEqual( results, c.upper() )
Beispiel #5
0
    def testMuchRecursion( self ):
        cases = range( ord("a"), ord("z") )
        cases = [ chr( c ) for c in cases ]

        xml_data = "<xml>%s</xml>"
        innerText = ""
        for c in cases[:-1]:
            xml_data %= ( "<%s>%s</%s>" % ( c, c.upper()+"%s", c ) )
            innerText += c.upper()
        c = cases[-1]
        xml_data %= ( "<%s>%s</%s>" % ( c, c.upper(), c ) )
        innerText += c.upper()

        document = xml.dom.minidom.parseString( xml_data )

        # There should be only one dom node for the "xml" tag name.
        nodes = document.getElementsByTagName( "xml" )
        self.failUnlessEqual( len(nodes), 1 )
        
        # The inner xml should be exactly the tag name, uppercased.
        results = xml_tools.get_inner_text( nodes[0] )
        self.failUnlessEqual( results, innerText )
Beispiel #6
0
    def testMuchRecursion( self ):
        cases = range( ord("a"), ord("z") )
        cases = [ chr( c ) for c in cases ]

        xml_data = "<xml>%s</xml>"
        innerText = ""
        for c in cases[:-1]:
            xml_data %= ( "<%s>%s</%s>" % ( c, c.upper()+"%s", c ) )
            innerText += c.upper()
        c = cases[-1]
        xml_data %= ( "<%s>%s</%s>" % ( c, c.upper(), c ) )
        innerText += c.upper()

        document = xml.dom.minidom.parseString( xml_data )

        # There should be only one dom node for the "xml" tag name.
        nodes = document.getElementsByTagName( "xml" )
        self.failUnlessEqual( len(nodes), 1 )
        
        # The inner xml should be exactly the tag name, uppercased.
        results = xml_tools.get_inner_text( nodes[0] )
        self.failUnlessEqual( results, innerText )