示例#1
0
 def test_find_multi_methods(self, method):
     node = Soupy("""
         <div>
            <div></div>
            <b><div></div></b>
            <div></div>
        </div>
        """).find('b')
     dom = node.val()
     expected = getattr(dom, method)('div')
     assert expected
     actual = getattr(node, method)('div').val()
     assert actual == expected
示例#2
0
 def test_find_multi_methods(self, method):
     node = Soupy("""
         <div>
            <div></div>
            <b><div></div></b>
            <div></div>
        </div>
        """).find('b')
     dom = node.val()
     expected = getattr(dom, method)('div')
     assert expected
     actual = getattr(node, method)('div').val()
     assert actual == expected
示例#3
0
 def test_node_properties(self, attr):
     node = Soupy('<b><d></d><c>test</c><d></d></b>').find('c')
     dom = node.val()
     assert getattr(node, attr).val() == getattr(dom, attr)
示例#4
0
 def test_scalar_properties(self, attr):
     node = Soupy('<a class="foo"><b><c>test</c></b></a>').find('c')
     dom = node.val()
     assert getattr(node, attr).val() == getattr(dom, attr)
示例#5
0
 def test_collection_properties(self, attr):
     node = Soupy('<a class="foo"><b><c>test</c></b></a>').find('b')
     dom = node.val()
     assert list(getattr(node, attr).val()) == list(getattr(dom, attr))
示例#6
0
    def test_prettify(self):
        s = Soupy('<html>∂ƒ</html>')

        assert s.prettify() == s.val().prettify()
示例#7
0
 def test_call(self):
     node = Soupy('<a class="test">test</a>')
     assert node('a').val() == node.val()('a')
示例#8
0
 def test_iter(self):
     node = Soupy('<a class="test">test</a>')
     for a, b in zip(node, node.val()):
         assert a.val() == b
示例#9
0
 def test_node_properties(self, attr):
     node = Soupy('<b><d></d><c>test</c><d></d></b>').find('c')
     dom = node.val()
     assert getattr(node, attr).val() == getattr(dom, attr)
示例#10
0
 def test_scalar_properties(self, attr):
     node = Soupy('<a class="foo"><b><c>test</c></b></a>').find('c')
     dom = node.val()
     assert getattr(node, attr).val() == getattr(dom, attr)
示例#11
0
 def test_collection_properties(self, attr):
     node = Soupy('<a class="foo"><b><c>test</c></b></a>').find('b')
     dom = node.val()
     assert list(getattr(node, attr).val()) == list(getattr(dom, attr))
示例#12
0
    def test_prettify(self):
        s = Soupy('<html>∂ƒ</html>')

        assert s.prettify() == s.val().prettify()
示例#13
0
 def test_call(self):
     node = Soupy('<a class="test">test</a>')
     assert node('a').val() == node.val()('a')
示例#14
0
 def test_iter(self):
     node = Soupy('<a class="test">test</a>')
     for a, b in zip(node, node.val()):
         assert a.val() == b