本文整理汇总了Python中pupa.scrape.Organization.validate方法的典型用法代码示例。如果您正苦于以下问题:Python Organization.validate方法的具体用法?Python Organization.validate怎么用?Python Organization.validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pupa.scrape.Organization
的用法示例。
在下文中一共展示了Organization.validate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_org_add_post
# 需要导入模块: from pupa.scrape import Organization [as 别名]
# 或者: from pupa.scrape.Organization import validate [as 别名]
def test_org_add_post():
""" Test that we can hack posts in on the fly'"""
orga = Organization("name", classification="committee")
orga.add_source(url='foo')
orga.validate()
orga.add_post("Human Readable Name", "Chef")
assert orga._related[0].role == "Chef"
assert orga._related[0].label == "Human Readable Name"
示例2: test_no_source_on_party_org
# 需要导入模块: from pupa.scrape import Organization [as 别名]
# 或者: from pupa.scrape.Organization import validate [as 别名]
def test_no_source_on_party_org():
org = Organization('Hat', classification='party')
# no source? no problem because classification = party
org.validate()
示例3: test_basic_invalid_organization
# 需要导入模块: from pupa.scrape import Organization [as 别名]
# 或者: from pupa.scrape.Organization import validate [as 别名]
def test_basic_invalid_organization():
orga = Organization("name")
# no source
with pytest.raises(ValidationError):
orga.validate()
示例4: test_basic_organization
# 需要导入模块: from pupa.scrape import Organization [as 别名]
# 或者: from pupa.scrape.Organization import validate [as 别名]
def test_basic_organization():
org = Organization('some org', classification='committee')
org.add_source('http://example.com')
assert org.name in str(org)
org.validate()