Esempio n. 1
0
 def test_US20_Aunts_and_uncles(self):
     t1 = Family("t1")
     t2 = Family("t2")
     t3 = Family("t3")
     t4 = Family("t4")
     t5 = Family("t5")
     t6 = Family("t6")
     t7 = Family("t7")
     t8 = Family("t8")
     t9 = Family("t9")
     t10 = Family("t10")
     t11 = Family("t11")
     t12 = Family("t12")
     p1 = Individual("p1")
     p2 = Individual("p2")
     p3 = Individual("p3")
     p4 = Individual("p4")
     p5 = Individual("p5")
     p6 = Individual("p6")
     p7 = Individual("p7")
     p8 = Individual("p8")
     p9 = Individual("p9")
     p10 = Individual("p10")
     p11 = Individual("p11")
     # --------------------------------------------------
     p11.set_parentFamily(t1)
     t1.set_husband(p1)
     t1.set_wife(p2)
     p1.set_parentFamily(t2)
     p2.set_parentFamily(t3)
     #t2.set_husband(p3)
     #t2.set_wife(p4)
     #t3.set_husband(p5)
     #t3.set_wife(p6)
     t2.set_children([p1, p7, p8])
     t3.set_children([p2, p9, p10])
     '''
     t1.add_child(p3)
     t1.add_child(p4)
     t2.set_husband(p3)
     t3.set_wife(p4)
     t2.add_child(p5)
     t3.add_child(p6)
     t4.set_husband(p7)
     t4.set_wife(p8)
     t4.add_child(p9)
     t4.add_child(p10)
     t5.set_husband(p9)
     t5.add_child(p11)
     t6.set_husband(p10)
     t6.set_wife(p11)
     '''
     # --------------------------------------------------
     assert p11.aunts_and_uncles() == True
Esempio n. 2
0
    def testMLastNames(self):
        #family1
        fam1 = Family("1")
        #Husband
        ind1 = Individual("1")
        ind1.set_gender("M")
        ind1.set_name("Charles Glass")

        #Wife
        ind2 = Individual("2")
        ind2.set_gender("F")
        ind2.set_name("Betty Glass")

        #Child 1
        ind3 = Individual("3")
        ind3.set_gender("M")
        ind3.set_name("Nate Glass")

        # Child 2
        ind4 = Individual("4")
        ind4.set_gender("M")
        ind4.set_name("Bobby Glass")

        # Child 3
        ind5 = Individual("5")
        ind5.set_gender("M")
        ind5.set_name("Jack Glass")

        fam1.set_wife(ind2)
        fam1.set_husband(ind1)
        fam1.set_marriedDate((1989, 7, 25))
        fam1.set_children([ind3, ind4, ind5])

        self.assertTrue(fam1.male_last_names())

        #family2
        fam2 = Family("2")
        # Husband
        ind6 = Individual("6")
        ind6.set_gender("M")
        ind6.set_name("Charles Glass")

        # Wife
        ind7 = Individual("7")
        ind7.set_gender("F")
        ind7.set_name("Betty Glass")

        # Child 1
        ind8 = Individual("8")
        ind8.set_gender("F")
        ind8.set_name("Nancy Glass")

        # Child 2
        ind9 = Individual("9")
        ind9.set_gender("M")
        ind9.set_name("Bobby Tarantino")

        # Child 3
        ind10 = Individual("10")
        ind10.set_gender("M")
        ind10.set_name("Jack Glass")

        fam2.set_wife(ind7)
        fam2.set_husband(ind6)
        fam2.set_marriedDate((1992, 3, 17))
        fam2.set_children([ind8, ind9, ind10])

        self.assertFalse(fam2.male_last_names())

        #fam3
        fam3 = Family('3')
        #husband
        fam3.set_husband(ind3)
        ind3.add_to_family(fam3)
        #wife
        ind11 = Individual("11")
        ind11.set_gender("F")
        ind11.set_name("Sandy Glass")
        # Child 1
        ind12 = Individual("12")
        ind12.set_gender("F")
        ind12.set_name("Nancy T")

        # Child 2
        ind13 = Individual("13")
        ind13.set_gender("M")
        ind13.set_name("Bobby Glass")

        fam3.set_wife(ind11)
        fam3.set_children([ind12, ind13])

        self.assertTrue(fam1.male_last_names())

        # fam4
        fam4 = Family('4')
        # husband
        fam4.set_husband(ind4)
        ind4.add_to_family(fam4)
        # wife
        ind14 = Individual("14")
        ind14.set_gender("F")
        ind14.set_name("Sandy Glass")

        # Child 1
        ind15 = Individual("15")
        ind15.set_gender("F")
        ind15.set_name("Nancy T")

        # Child 2
        ind16 = Individual("16")
        ind16.set_gender("M")
        ind16.set_name("Bobby T")

        fam4.set_wife(ind14)
        fam4.set_children([ind15, ind16])

        self.assertFalse(fam1.male_last_names())
Esempio n. 3
0
    def testNoMarriagesToDescendants(self):
        ## BASE CASE(husband and wife has no parent family)

        #fam1
        fam1 = Family("1")
        # Husband
        ind1 = Individual("1")
        ind1.set_gender("M")
        ind1.add_to_family(fam1)
        # Wife
        ind2 = Individual("2")
        ind2.set_gender("F")
        ind2.add_to_family(fam1)
        # Child 1
        ind3 = Individual("3")
        ind3.set_gender("M")
        # Child 2
        ind4 = Individual("4")
        ind4.set_gender("M")
        # Child 3
        ind5 = Individual("5")
        ind5.set_gender("F")

        fam1.set_husband(ind1)
        fam1.set_wife(ind2)
        fam1.set_marriedDate((1989, 7, 25))
        fam1.set_children([ind3, ind4, ind5])
        self.assertTrue(ind1.no_marriages_to_descendants())

        #fam2
        fam2 = Family("2")
        # Husband
        ind6 = Individual("6")
        ind6.set_gender("M")
        ind6.add_to_family(fam2)
        # Wife
        ind7 = Individual("7")
        ind7.set_gender("F")
        ind7.add_to_family(fam2)
        # Child 1
        ind8 = Individual("8")
        # Child 2
        ind9 = Individual("9")
        ind9.set_gender("M")
        # Child 3
        ind10 = Individual("10")
        ind10.set_gender("F")

        fam2.set_husband(ind6)
        fam2.set_wife(ind7)
        fam2.set_marriedDate((1989, 7, 25))
        fam2.set_children([ind6, ind9, ind10])

        self.assertFalse(ind7.no_marriages_to_descendants())

        #fam3
        fam3 = Family("3")
        # Husband
        fam3.set_husband(ind3)
        ind3.add_to_family(fam3)
        # Wife
        ind11 = Individual("11")
        ind11.set_gender("F")
        # Child 1
        ind12 = Individual("12")
        ind12.set_gender("M")
        # Child 2
        ind13 = Individual("13")
        ind13.set_gender("F")

        fam3.set_wife(ind11)
        fam3.set_children([ind12, ind13])

        self.assertTrue(ind1.no_marriages_to_descendants())

        #fam4
        fam4 = Family("4")
        # Husband
        fam4.set_husband(ind12)
        ind12.add_to_family(fam4)
        # Wife
        ind14 = Individual("14")
        ind14.set_gender("F")
        # Child 1
        ind15 = Individual("15")
        # Child 2
        ind16 = Individual("16")
        ind16.set_gender("M")

        fam4.set_wife(ind14)
        fam4.set_children([ind2, ind16])

        self.assertFalse(ind1.no_marriages_to_descendants())