summaryrefslogtreecommitdiff
path: root/src/beautifulsoup/tests/test_lxml.py
blob: c0ed31e6ea8f58c17299ca1bbc3dd80a8bc55b93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from helpers import SoupTest
from beautifulsoup.builder.lxml_builder import LXMLTreeBuilder


class TestLXMLBuilder(SoupTest):

    def test_bare_string(self):
        self.assertSoupEquals(
            "A bare string", "<p>A bare string</p>")

    def test_tag_nesting(self):
        b_tag = "<b>Inside a B tag</b>"
        self.assertSoupEquals(b_tag)

        nested_b_tag = "<p>A <i>nested <b>tag</b></i></p>"
        self.assertSoupEquals(nested_b_tag)

    def test_self_closing(self):
        self.assertSoupEquals(
            "<p>A <meta> tag</p>", "<p>A <meta /> tag</p>")