def test_select_select(self): root = KitSelector(self.qt_doc) self.assertEquals( set(['one', 'yet one']), set([x.text() for x in root.select('ul').select('li:first-child')]), )
def test_textselector(self): self.assertEquals('one', KitSelector(self.qt_doc).select('li').text())
def test_html(self): sel = KitSelector(self.qt_doc).select('h1')[0] self.assertEquals('<h1>test</h1>', sel.html())
def test_select_node(self): sel = KitSelector(self.qt_doc).select('h1')[0] self.assertEquals('test', sel.node.toInnerXml())
def test_in_general(self): sel = KitSelector(self.qt_doc)
def test_exists(self): sel = KitSelector(self.qt_doc).select('li:nth-child(4)') self.assertEquals(True, sel.exists()) sel = KitSelector(self.qt_doc).select('li:nth-child(5)') self.assertEquals(False, sel.exists())
def test_number(self): sel = KitSelector(self.qt_doc).select('li:nth-child(4)') self.assertEquals(4, sel.number())
def test_text_list(self): root = KitSelector(self.qt_doc) self.assertEquals( set(['one', 'yet one']), set(root.select('ul > li:first-child').text_list()), )
def test_one(self): sel = KitSelector(self.qt_doc).select('ul > li') self.assertEquals('one', unicode(sel.one().node.toPlainText())) self.assertEquals('one', sel.text())
def test_attr_list(self): root = KitSelector(self.qt_doc) self.assertEquals(set(['li-1', 'li-2']), set(root.select('ul[id=second-list] > li')\ .attr_list('class')) )
def test_text_list(self): root = KitSelector(self.qt_doc) self.assertEquals(set(['one', 'yet one']), set(root.select('ul > li:first-child').text_list()), )
def test_select_select(self): root = KitSelector(self.qt_doc) self.assertEquals(set(['one', 'yet one']), set([x.text() for x in root.select('ul').select('li:first-child')]), )
def test_number(self): self.assertEquals(4, KitSelector(self.qt_doc).select('li.zzz').number())
def select(self, *args, **kwargs): qt_doc = self.grab.transport.kit.page.mainFrame().documentElement() return KitSelector(qt_doc).select(*args, **kwargs)