当前位置: 首页>>代码示例>>Python>>正文


Python Individual.getSex方法代码示例

本文整理汇总了Python中individual.Individual.getSex方法的典型用法代码示例。如果您正苦于以下问题:Python Individual.getSex方法的具体用法?Python Individual.getSex怎么用?Python Individual.getSex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在individual.Individual的用法示例。


在下文中一共展示了Individual.getSex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_addSex

# 需要导入模块: from individual import Individual [as 别名]
# 或者: from individual.Individual import getSex [as 别名]
 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)      
开发者ID:Gosin,项目名称:gedcom,代码行数:11,代码来源:individualTest.py

示例2: test_getSex

# 需要导入模块: from individual import Individual [as 别名]
# 或者: from individual.Individual import getSex [as 别名]
 def test_getSex(self):
     SEX = 'M'
     self.assertEqual(self.indi.getSex(), SEX)
     
     indi = Individual()
     self.assertEqual(indi.getSex(), None)
开发者ID:Gosin,项目名称:gedcom,代码行数:8,代码来源:individualTest.py

示例3: IndividualTest

# 需要导入模块: from individual import Individual [as 别名]
# 或者: from individual.Individual import getSex [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]']
#.........这里部分代码省略.........
开发者ID:Gosin,项目名称:gedcom,代码行数:103,代码来源:individualTest.py


注:本文中的individual.Individual.getSex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。