本文整理汇总了Python中person.models.Person.get_name_parts方法的典型用法代码示例。如果您正苦于以下问题:Python Person.get_name_parts方法的具体用法?Python Person.get_name_parts怎么用?Python Person.get_name_parts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类person.models.Person
的用法示例。
在下文中一共展示了Person.get_name_parts方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_chantal_nijkerken_de_haan
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import get_name_parts [as 别名]
def test_chantal_nijkerken_de_haan(self):
wikidata_id = 'Q19830701'
wikidata_item = wikidata.WikidataItem(wikidata_id)
fullname = wikidata_item.get_label()
forename, surname, surname_prefix = Person.get_name_parts(fullname, wikidata_item)
self.assertEqual(forename, 'Chantal')
self.assertEqual(surname, 'Nijkerken-de Haan')
示例2: test_leendert_de_lange
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import get_name_parts [as 别名]
def test_leendert_de_lange(self):
wikidata_id = 'Q19839084'
wikidata_item = wikidata.WikidataItem(wikidata_id)
fullname = wikidata_item.get_label()
forename, surname, surname_prefix = Person.get_name_parts(fullname, wikidata_item)
self.assertEqual(forename, 'Leendert')
self.assertEqual(surname_prefix, 'de')
self.assertEqual(surname, 'Lange')
示例3: test_sybrand_van_haersma_buma
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import get_name_parts [as 别名]
def test_sybrand_van_haersma_buma(self):
wikidata_id = 'Q377266'
wikidata_item = wikidata.WikidataItem(wikidata_id)
fullname = wikidata_item.get_label()
forename, surname, surname_prefix = Person.get_name_parts(fullname, wikidata_item)
self.assertEqual(forename, 'Sybrand')
self.assertEqual(surname, 'Haersma Buma')
self.assertEqual(surname_prefix, 'van')
示例4: test_sjoerd_sjoerdsma
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import get_name_parts [as 别名]
def test_sjoerd_sjoerdsma(self):
wikidata_id = 'Q516335'
wikidata_item = wikidata.WikidataItem(wikidata_id)
fullname = wikidata_item.get_label()
forename, surname, surname_prefix = Person.get_name_parts(fullname, wikidata_item)
self.assertEqual(forename, 'Sjoerd')
self.assertEqual(surname, 'Sjoerdsma')
self.assertEqual(surname_prefix, '')
示例5: test_jan_kees_de_jager
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import get_name_parts [as 别名]
def test_jan_kees_de_jager(self):
wikidata_id = 'Q1666631'
wikidata_item = wikidata.WikidataItem(wikidata_id)
fullname = wikidata_item.get_label()
forename, surname, surname_prefix = Person.get_name_parts(fullname, wikidata_item)
self.assertEqual(forename, 'Jan Kees')
self.assertEqual(surname, 'Jager')
self.assertEqual(surname_prefix, 'de')
示例6: test_jan_peter_balkenende
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import get_name_parts [as 别名]
def test_jan_peter_balkenende(self):
wikidata_id = 'Q133386'
wikidata_item = wikidata.WikidataItem(wikidata_id)
fullname = wikidata_item.get_label()
forename, surname, surname_prefix = Person.get_name_parts(fullname, wikidata_item)
self.assertEqual(forename, 'Jan Peter')
self.assertEqual(surname, 'Balkenende')
self.assertEqual(surname_prefix, '')
示例7: test_fatma_koser_kaya
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import get_name_parts [as 别名]
def test_fatma_koser_kaya(self):
wikidata_id = 'Q467610' # Fatma Koşer Kaya
wikidata_item = wikidata.WikidataItem(wikidata_id)
fullname = wikidata_item.get_label()
forename, surname, surname_prefix = Person.get_name_parts(fullname, wikidata_item)
self.assertEqual(forename, 'Fatma')
self.assertEqual(surname, 'Koşer Kaya')
self.assertEqual(surname_prefix, '')
示例8: create_person
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import get_name_parts [as 别名]
def create_person(wikidata_id, fullname, wikidata_item, add_initials):
if not fullname:
fullname = wikidata_item.get_label(language='nl')
forename, surname, surname_prefix = Person.get_name_parts(fullname, wikidata_item)
person = Person.objects.create(
forename=forename,
surname=surname,
surname_prefix=surname_prefix,
wikidata_id=wikidata_id
)
person.update_info(language='nl', wikidata_item=wikidata_item)
person.save()
if add_initials and person.parlement_and_politiek_id:
person.initials = scraper.persons.get_initials(person.parlement_and_politiek_id)
person.save()
assert person.wikidata_id == wikidata_id
return person