def should_unmarshal(self):
     converter = XmlConverter()
     result = converter.unmarshal('<html><img><link href="http://google.com" rel="alternative" type="application/xml">A Link</link><link href="http://yahoo.com" rel="self" type="application/xml" /></img></html>')
     assert result.tag == 'html'
     assert result.img.tag == 'img'
     assert result.img.link[0].text == 'A Link'
     assert len(result.img.link) == 2
     assert len(result.links().links) == 2
예제 #2
0
 def should_unmarshal(self):
     converter = XmlConverter()
     result = converter.unmarshal(
         '<html><img><link href="http://google.com" rel="alternative" type="application/xml">A Link</link><link href="http://yahoo.com" rel="self" type="application/xml" /></img></html>'
     )
     assert result.tag == 'html'
     assert result.img.tag == 'img'
     assert result.img.link[0].text == 'A Link'
     assert len(result.img.link) == 2
     assert len(result.links().links) == 2
예제 #3
0
    def should_unmarshal(self):
        xml = XmlConverter()
        result = xml.unmarshal('<html><div><link href="http://google.com" ' +
                               'rel="alternative" type="application/xml">' +
                               'A Link</link><link href="http://yahoo.com" ' +
                               'rel="self" type="application/xml" /></div>' +
                               '<div>Hello World</div>' + '</html>')

        assert result.tag == 'html'
        assert len(result.div) == 2
        assert result.div[0].tag == 'div'
        assert result.div[0].link[0].text == 'A Link'
        assert len(result.div[0].link) == 2
        assert len(result.links()) == 2
예제 #4
0
    def should_unmarshal(self):
        xml = XmlConverter()
        result = xml.unmarshal('<html><div><link href="http://google.com" ' +
                               'rel="alternative" type="application/xml">' +
                               'A Link</link><link href="http://yahoo.com" ' +
                               'rel="self" type="application/xml" /></div>' +
                               '<div>Hello World</div>' +
                               '</html>')

        assert result.tag == 'html'
        assert len(result.div) == 2
        assert result.div[0].tag == 'div'
        assert result.div[0].link[0].text == 'A Link'
        assert len(result.div[0].link) == 2
        assert len(result.links()) == 2