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
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)
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)
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))
def test_prettify(self): s = Soupy('<html>∂ƒ</html>') assert s.prettify() == s.val().prettify()
def test_call(self): node = Soupy('<a class="test">test</a>') assert node('a').val() == node.val()('a')
def test_iter(self): node = Soupy('<a class="test">test</a>') for a, b in zip(node, node.val()): assert a.val() == b