Exemplo n.º 1
0
    def test_content_parser_no_sections(self):

        parser = search_index.ContentParser()

        parser.feed("No H1 or H2<span>Title</span>TEST")

        self.assertEquals(parser.data, [])
Exemplo n.º 2
0
    def test_html_stripping(self):

        stripper = search_index.ContentParser()

        stripper.feed("<h1>Testing</h1><p>Content</p>")

        self.assertEqual(stripper.stripped_html, "Testing\nContent")
Exemplo n.º 3
0
    def test_content_parser_content_before_header(self):

        parser = search_index.ContentParser()

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

        self.assertEquals(parser.data, [
            search_index.ContentSection(text=["TEST"], id_=None, title="Title")
        ])
Exemplo n.º 4
0
    def test_content_parser_no_id(self):

        parser = search_index.ContentParser()

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

        self.assertEqual(parser.data, [
            search_index.ContentSection(text=["TEST"], id_=None, title="Title")
        ])
Exemplo n.º 5
0
    def test_content_parser(self):

        parser = search_index.ContentParser()

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

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