Exemplo n.º 1
0
 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')]),
     )
Exemplo n.º 2
0
 def test_textselector(self):
     self.assertEquals('one', KitSelector(self.qt_doc).select('li').text())
Exemplo n.º 3
0
 def test_html(self):
     sel = KitSelector(self.qt_doc).select('h1')[0]
     self.assertEquals('<h1>test</h1>', sel.html())
Exemplo n.º 4
0
 def test_select_node(self):
     sel = KitSelector(self.qt_doc).select('h1')[0]
     self.assertEquals('test', sel.node.toInnerXml())
Exemplo n.º 5
0
 def test_in_general(self):
     sel = KitSelector(self.qt_doc)
Exemplo n.º 6
0
    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())
Exemplo n.º 7
0
 def test_number(self):
     sel = KitSelector(self.qt_doc).select('li:nth-child(4)')
     self.assertEquals(4, sel.number())
Exemplo n.º 8
0
 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()),
     )
Exemplo n.º 9
0
 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())
Exemplo n.º 10
0
 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'))
                       )
Exemplo n.º 11
0
 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()),
                       )
Exemplo n.º 12
0
 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')]),
                       )
Exemplo n.º 13
0
 def test_html(self):
     sel = KitSelector(self.qt_doc).select('h1')[0]
     self.assertEquals('<h1>test</h1>', sel.html())
Exemplo n.º 14
0
    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())
Exemplo n.º 15
0
 def test_number(self):
     self.assertEquals(4,
                       KitSelector(self.qt_doc).select('li.zzz').number())
Exemplo n.º 16
0
 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())
Exemplo n.º 17
0
 def test_number(self):
     sel = KitSelector(self.qt_doc).select('li:nth-child(4)')
     self.assertEquals(4, sel.number())
Exemplo n.º 18
0
 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'))
                       )
Exemplo n.º 19
0
 def select(self, *args, **kwargs):
     qt_doc = self.grab.transport.kit.page.mainFrame().documentElement()
     return KitSelector(qt_doc).select(*args, **kwargs)