本文整理汇总了Python中soupy.Soupy.val方法的典型用法代码示例。如果您正苦于以下问题:Python Soupy.val方法的具体用法?Python Soupy.val怎么用?Python Soupy.val使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soupy.Soupy
的用法示例。
在下文中一共展示了Soupy.val方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_find_multi_methods
# 需要导入模块: from soupy import Soupy [as 别名]
# 或者: from soupy.Soupy import val [as 别名]
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: test_node_properties
# 需要导入模块: from soupy import Soupy [as 别名]
# 或者: from soupy.Soupy import val [as 别名]
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)
示例3: test_scalar_properties
# 需要导入模块: from soupy import Soupy [as 别名]
# 或者: from soupy.Soupy import val [as 别名]
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)
示例4: test_collection_properties
# 需要导入模块: from soupy import Soupy [as 别名]
# 或者: from soupy.Soupy import val [as 别名]
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))
示例5: test_prettify
# 需要导入模块: from soupy import Soupy [as 别名]
# 或者: from soupy.Soupy import val [as 别名]
def test_prettify(self):
s = Soupy('<html>∂ƒ</html>')
assert s.prettify() == s.val().prettify()
示例6: test_call
# 需要导入模块: from soupy import Soupy [as 别名]
# 或者: from soupy.Soupy import val [as 别名]
def test_call(self):
node = Soupy('<a class="test">test</a>')
assert node('a').val() == node.val()('a')
示例7: test_iter
# 需要导入模块: from soupy import Soupy [as 别名]
# 或者: from soupy.Soupy import val [as 别名]
def test_iter(self):
node = Soupy('<a class="test">test</a>')
for a, b in zip(node, node.val()):
assert a.val() == b