本文整理匯總了Python中individual.Individual.getID方法的典型用法代碼示例。如果您正苦於以下問題:Python Individual.getID方法的具體用法?Python Individual.getID怎麽用?Python Individual.getID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類individual.Individual
的用法示例。
在下文中一共展示了Individual.getID方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: IndividualTest
# 需要導入模塊: from individual import Individual [as 別名]
# 或者: from individual.Individual import getID [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_getID
# 需要導入模塊: from individual import Individual [as 別名]
# 或者: from individual.Individual import getID [as 別名]
def test_getID(self):
ID = '@[email protected]'
self.assertEqual(self.indi.getID(), ID)
indi = Individual()
self.assertEqual(indi.getID(), None)
示例3: test_addID
# 需要導入模塊: from individual import Individual [as 別名]
# 或者: from individual.Individual import getID [as 別名]
def test_addID(self):
indi = Individual()
value = '@[email protected]'
indi.addID(value)
self.assertEqual(indi.getID(), value)