Beispiel #1
0
    def test_combine_parts(self):
        docs = [
            HTMLFeatureInfoDoc('<p>foo</p>'),
            HTMLFeatureInfoDoc('<body><p>bar</p></body>'),
            HTMLFeatureInfoDoc('<html><head><title>Hello<body><p>baz</p><p>baz2'),
        ]
        result = HTMLFeatureInfoDoc.combine(docs)

        assert (b'<body><p>foo</p><p>bar</p><p>baz</p><p>baz2</p></body>' in
            result.as_string())
        eq_(result.info_type, 'html')
Beispiel #2
0
    def test_combine(self):
        docs = [
            HTMLFeatureInfoDoc(b'<html><head><title>Hello<body><p>baz</p><p>baz2'),
            HTMLFeatureInfoDoc(b'<p>foo</p>'),
            HTMLFeatureInfoDoc(b'<body><p>bar</p></body>'),
        ]
        result = HTMLFeatureInfoDoc.combine(docs)

        eq_(b"<html><head><title>Hello<body><p>baz</p>"
            b"<p>baz2\n<p>foo</p>\n<body><p>bar</p></body>",
            result.as_string())
        eq_(result.info_type, 'text')
Beispiel #3
0
    def test_combine_parts(self):
        docs = [
            HTMLFeatureInfoDoc("<p>foo</p>"),
            HTMLFeatureInfoDoc("<body><p>bar</p></body>"),
            HTMLFeatureInfoDoc(
                "<html><head><title>Hello<body><p>baz</p><p>baz2"),
        ]
        result = HTMLFeatureInfoDoc.combine(docs)

        assert (b"<body><p>foo</p><p>bar</p><p>baz</p><p>baz2</p></body>"
                in result.as_string())
        assert result.info_type == "html"
Beispiel #4
0
    def test_combine_parts(self):
        docs = [
            HTMLFeatureInfoDoc('<p>foo</p>'),
            HTMLFeatureInfoDoc('<body><p>bar</p></body>'),
            HTMLFeatureInfoDoc('<html><head><title>Hello<body><p>baz</p><p>baz2'),
        ]
        result = HTMLFeatureInfoDoc.combine(docs)

        assert (b'<body><p>foo</p><p>bar</p><p>baz</p><p>baz2</p></body>' in
            result.as_string())
        eq_(result.info_type, 'html')
Beispiel #5
0
    def test_combine(self):
        docs = [
            HTMLFeatureInfoDoc(b'<html><head><title>Hello<body><p>baz</p><p>baz2'),
            HTMLFeatureInfoDoc(b'<p>foo</p>'),
            HTMLFeatureInfoDoc(b'<body><p>bar</p></body>'),
        ]
        result = HTMLFeatureInfoDoc.combine(docs)

        eq_(b"<html><head><title>Hello<body><p>baz</p>"
            b"<p>baz2\n<p>foo</p>\n<body><p>bar</p></body>",
            result.as_string())
        eq_(result.info_type, 'text')
Beispiel #6
0
 def test_as_etree(self):
     doc = HTMLFeatureInfoDoc('<p>hello</p>')
     eq_(doc.as_etree().find('body/p').text, 'hello')
Beispiel #7
0
 def test_as_string(self):
     input_tree = html.fromstring('<p>Foo')
     doc = HTMLFeatureInfoDoc(input_tree)
     assert b'<body><p>Foo</p></body>' in strip_whitespace(doc.as_string())
Beispiel #8
0
 def test_as_etree(self):
     doc = HTMLFeatureInfoDoc('<p>hello</p>')
     eq_(doc.as_etree().find('body/p').text, 'hello')
Beispiel #9
0
 def test_as_string(self):
     input_tree = html.fromstring('<p>Foo')
     doc = HTMLFeatureInfoDoc(input_tree)
     assert b'<body><p>Foo</p></body>' in strip_whitespace(doc.as_string())
Beispiel #10
0
 def test_as_etree(self):
     doc = HTMLFeatureInfoDoc("<p>hello</p>")
     assert doc.as_etree().find("body/p").text == "hello"