コード例 #1
0
    def test_family(self):
        '''
        This test will check the basic operation of family classes
        '''
        father = gen_profile("Father", "Profile")
        mother = gen_profile("Mother", "Profile")
        child1 = gen_profile("Child", "First")
        child2 = gen_profile("Child", "Second")

        event1 = event_profile("birth")
        assert (event1.setDate(2013, month=2, accuracy="ABOUT"))

        family1 = family_profile(child=3)
        assert (len(family1.getChildren()) == 1)

        family2 = family_profile(child=[1, 2])
        assert (len(family2.getChildren()) == 2)

        family3 = family_profile(child=[1, 2],
                                 father=3,
                                 mother=4,
                                 marriage=event1)
        assert (family3.father and family3.mother and family3.children
                and family3.marriage)
        assert (family3.getFather() == 3)
        assert (family3.getMother() == 4)
コード例 #2
0
 def add_family(self,
                father=None,
                mother=None,
                children=None,
                marriage=None):
     '''
     It will create and add a new family to the database
     it is better that each database will create their own families
     '''
     self.count_fam += 1
     id_fam = CHAR_FAM + str(self.count_fam)
     fam = family_profile(father=father,
                          mother=mother,
                          child=children,
                          marriage=marriage)
     self.families[id_fam] = fam
     return id_fam
コード例 #3
0
 def add_family(self,
                father=None,
                mother=None,
                children=None,
                marriage=None):
     '''
     It will create and add a new family to the database
     it is better that each database will create their own families
     father, mother the id of them
     child should be an string of get_child
     marriage is an event
     '''
     self.count_fam += 1
     id_fam = CHAR_FAM + str(self.count_fam)
     fam = family_profile(father=father,
                          mother=mother,
                          child=children,
                          marriage=marriage)
     fam.set_id(id_fam)
     self.families[id_fam] = fam
     return id_fam