示例#1
0
    def test_content_parser(self):

        parser = search.ContentParser()

        parser.feed('<h1 id="title">Title</h1>TEST')

        self.assertEquals(
            parser.data,
            [search.ContentSection(text=["TEST"], id_="title", title="Title")])
示例#2
0
    def test_content_parser_content_before_header(self):

        parser = search.ContentParser()

        parser.feed("Content Before H1 <h1>Title</h1>TEST")

        self.assertEquals(
            parser.data,
            [search.ContentSection(text=["TEST"], id_=None, title="Title")])
示例#3
0
    def test_content_parser_no_id(self):

        parser = search.ContentParser()

        parser.feed("<h1>Title</h1>TEST")
        parser.close()

        self.assertEquals(
            parser.data,
            [search.ContentSection(text=["TEST"], id_=None, title="Title")])