本文整理汇总了Python中person.models.Person.find_by_fullname方法的典型用法代码示例。如果您正苦于以下问题:Python Person.find_by_fullname方法的具体用法?Python Person.find_by_fullname怎么用?Python Person.find_by_fullname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类person.models.Person
的用法示例。
在下文中一共展示了Person.find_by_fullname方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_find_members
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import find_by_fullname [as 别名]
def test_find_members(self):
person = Person.find_by_fullname('Diederik Samsom')
member = ParliamentMember.find('Samsom', initials='D.M.')
self.assertEqual(member.person, person)
member = ParliamentMember.find('Samsom', initials='D.M.', date=datetime.date(year=2004, month=6, day=1))
self.assertEqual(member.person, person)
self.assertEqual(member.joined, datetime.date(year=2003, month=1, day=30))
member = ParliamentMember.find('Samsom', initials='D.M.', date=datetime.date(year=2016, month=6, day=1))
self.assertEqual(member.person, person)
self.assertEqual(member.joined, datetime.date(year=2012, month=9, day=20))
示例2: test_get_member_for_person_at_date
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import find_by_fullname [as 别名]
def test_get_member_for_person_at_date(self):
person = Person.find_by_fullname('Diederik Samsom')
members_all = ParliamentMember.objects.filter(person=person)
self.assertEqual(members_all.count(), 4)
members = ParliamentMember.find_at_date(person, datetime.date(year=2016, month=6, day=1))
self.assertEqual(members[0].joined, datetime.date(year=2012, month=9, day=20))
self.assertEqual(members.count(), 1)
self.assertEqual(members[0].person, person)
members = ParliamentMember.find_at_date(person, datetime.date(year=2004, month=6, day=1))
self.assertEqual(members[0].joined, datetime.date(year=2003, month=1, day=30))
self.assertEqual(members.count(), 1)
self.assertEqual(members[0].person, person)
示例3: test_find_by_fullname
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import find_by_fullname [as 别名]
def test_find_by_fullname(self):
p_found = Person.find_by_fullname('Jan Peter Balkenende')
self.assertEqual(self.p1, p_found)
p_found = Person.find_by_fullname('Jan Balkenende')
self.assertEqual(self.p2, p_found)
p_found = Person.find_by_fullname('Jan van Balkenende')
self.assertEqual(self.p3, p_found)
p_found = Person.find_by_fullname('Jan Peter van Balkenende')
self.assertEqual(self.p4, p_found)
p_found = Person.find_by_fullname('Jan Jaap van Balkenende')
self.assertEqual(None, p_found)
p_found = Person.find_by_fullname('van Raak')
self.assertEqual(self.p7, p_found)