本文整理汇总了Python中pupa.scrape.Person.pre_save方法的典型用法代码示例。如果您正苦于以下问题:Python Person.pre_save方法的具体用法?Python Person.pre_save怎么用?Python Person.pre_save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pupa.scrape.Person
的用法示例。
在下文中一共展示了Person.pre_save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_legislator_related_chamber_district
# 需要导入模块: from pupa.scrape import Person [as 别名]
# 或者: from pupa.scrape.Person import pre_save [as 别名]
def test_legislator_related_chamber_district():
leg = Person('John Adams', district='1', primary_org='upper')
leg.pre_save('jurisdiction-id')
assert len(leg._related) == 1
assert leg._related[0].person_id == leg._id
assert get_pseudo_id(leg._related[0].organization_id) == {'classification': 'upper'}
assert get_pseudo_id(leg._related[0].post_id) == {"organization__classification": "upper",
"label": "1"}
示例2: test_legislator_related_district
# 需要导入模块: from pupa.scrape import Person [as 别名]
# 或者: from pupa.scrape.Person import pre_save [as 别名]
def test_legislator_related_district():
l = Person('John Adams', district='1', primary_org='legislature')
l.pre_save('jurisdiction-id')
assert len(l._related) == 1
assert l._related[0].person_id == l._id
assert get_pseudo_id(l._related[0].organization_id) == {'classification': 'legislature'}
assert get_pseudo_id(l._related[0].post_id) == {"organization__classification": "legislature",
"label": "1", "role": "member"}
assert l._related[0].role == 'member'
示例3: test_legislator_related_party
# 需要导入模块: from pupa.scrape import Person [as 别名]
# 或者: from pupa.scrape.Person import pre_save [as 别名]
def test_legislator_related_party():
l = Person('John Adams', party='Democratic-Republican')
l.pre_save('jurisdiction-id')
# a party membership
assert len(l._related) == 1
assert l._related[0].person_id == l._id
assert get_pseudo_id(l._related[0].organization_id) == {'classification': 'party',
'name': 'Democratic-Republican'}
assert l._related[0].role == 'member'