Exemplo n.º 1
0
    def test_parse_index_row_returns_dict(self):
        p = Parser()
        elem = make_tree(SAMPLE_ROW)

        result = p.parse_index_row(elem)

        self.assertEqual(type(result), dict)
Exemplo n.º 2
0
    def test_index_nbytes_returns_nbytes(self):
        p = Parser()
        html = '<td class="tor-size"><u>123456</u></td>'
        nbytes = p.index_nbytes(make_tree(html))

        self.assertEqual(nbytes, 123456)
Exemplo n.º 3
0
    def test_index_timestamp_returns_timestamp(self):
        p = Parser()
        html = '<tr><td></td><td><u>123456</u></td></tr>'
        ts = p.index_timestamp(make_tree(html))

        self.assertEqual(ts, 123456)
Exemplo n.º 4
0
    def test_index_title_returns_title(self):
        p = Parser()
        html = '<td class="t-title"><div class="t-title"><a>Blah</a></div></td>'
        tid = p.index_title(make_tree(html))

        self.assertEqual(tid, 'Blah')
Exemplo n.º 5
0
    def test_index_tid_returns_tid(self):
        p = Parser()
        html = '<td class="t-title"><div class="t-title"><a data-topic_id="12345"></a></div></td>'
        tid = p.index_tid(make_tree(html))

        self.assertEqual(tid, 12345)