本文整理汇总了Python中individual.Individual.getFams方法的典型用法代码示例。如果您正苦于以下问题:Python Individual.getFams方法的具体用法?Python Individual.getFams怎么用?Python Individual.getFams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类individual.Individual
的用法示例。
在下文中一共展示了Individual.getFams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: IndividualTest
# 需要导入模块: from individual import Individual [as 别名]
# 或者: from individual.Individual import getFams [as 别名]
class IndividualTest(unittest.TestCase):
def setUp(self):
self.indi = Individual()
self.indi.addID('@[email protected]')
self.indi.addName('John Rivas')
self.indi.addSex('M')
self.indi.addBirt('9 MAY 1978')
self.indi.addDeat('12 APR 2013')
self.indi.addFams('@[email protected]')
self.indi.addFamc('@[email protected]')
""" Test setters """
def test_addID(self):
indi = Individual()
value = '@[email protected]'
indi.addID(value)
self.assertEqual(indi.getID(), value)
def test_addName(self):
indi = Individual()
value = "Gloop"
indi.addName(value)
self.assertEqual(indi.getName(), value)
def test_addSex(self):
indi = Individual()
value = "M"
indi.addSex(value)
self.assertEqual(indi.getSex(), value)
value = "F"
indi.addSex(value)
self.assertEqual(indi.getSex(), value)
def test_addBirt(self):
indi = Individual()
value = "01 JAN 1900"
indi.addBirt(value)
self.assertEqual(indi.getBirt(), value)
def test_addDeat(self):
indi = Individual()
value = "01 JAN 2000"
indi.addDeat(value)
self.assertEqual(indi.getDeat(), value)
def test_addFams(self):
indi = Individual()
value = '@[email protected]'
indi.addFams(value)
self.assertEqual(indi.getFams()[0], value)
def test_addFamc(self):
indi = Individual()
value = '@[email protected]'
indi.addFamc(value)
self.assertEqual(indi.getFamc()[0], value)
""" Test getters """
def test_getID(self):
ID = '@[email protected]'
self.assertEqual(self.indi.getID(), ID)
indi = Individual()
self.assertEqual(indi.getID(), None)
def test_getName(self):
NAME = 'John Rivas'
self.assertEqual(self.indi.getName(), NAME)
indi = Individual()
self.assertEqual(indi.getName(), None)
def test_getSex(self):
SEX = 'M'
self.assertEqual(self.indi.getSex(), SEX)
indi = Individual()
self.assertEqual(indi.getSex(), None)
def test_getBirt(self):
BIRT = '9 MAY 1978'
self.assertEqual(self.indi.getBirt(), BIRT)
indi = Individual()
self.assertEqual(indi.getBirt(), None)
def test_getDeat(self):
DEAT = '12 APR 2013'
self.assertEqual(self.indi.getDeat(), DEAT)
indi = Individual()
self.assertEqual(indi.getDeat(), None)
def test_getFams(self):
FAMS = ['@[email protected]']
#.........这里部分代码省略.........
示例2: test_addFams
# 需要导入模块: from individual import Individual [as 别名]
# 或者: from individual.Individual import getFams [as 别名]
def test_addFams(self):
indi = Individual()
value = '@[email protected]'
indi.addFams(value)
self.assertEqual(indi.getFams()[0], value)
示例3: test_getFams
# 需要导入模块: from individual import Individual [as 别名]
# 或者: from individual.Individual import getFams [as 别名]
def test_getFams(self):
FAMS = ['@[email protected]']
self.assertEqual(self.indi.getFams(), FAMS)
indi = Individual()
self.assertEqual(indi.getFams(), [])