def test_husband_spouseFam_invalid(self):
     husband = Individual("I1")
     testFam = Family("F1")
     testFam.husbandObject = husband
     US28_corresponding_family_entries_error(testFam)
     self.assertEqual(len(testFam.errors), 1)
     self.assertEqual(testFam.errors[0], "Corresponding spouse family not listed for husband individual")
 def test_husband_spouseFam_valid(self):
     husband = Individual("I1")
     testFam = Family("F1")
     testFam.husbandObject = husband
     husband.spouseFamilyObjects.append(testFam)
     US28_corresponding_family_entries_error(testFam)
     self.assertEqual(len(testFam.errors), 0)
     self.assertEqual(testFam.errors, [])
 def test_wife_spouseFam_valid_husband_spouseFam_invalid(self):
     wife = Individual("I1")
     husband = Individual("I2")
     testFam = Family("F1")
     testFam.wifeObject = wife
     testFam.husbandObject = husband
     wife.spouseFamilyObjects.append(testFam)
     US28_corresponding_family_entries_error(testFam)
     self.assertEqual(len(testFam.errors), 1)
     self.assertEqual(testFam.errors[0], "Corresponding spouse family not listed for husband individual")
示例#4
0
 def test_wifeYoungerThan14(self):
     wife = Individual("I1")
     husband = Individual("I2")
     fam = Family("F1")
     fam.wifeObject = wife
     fam.husbandObject = husband
     fam.wifeObject.birthDateObject = datetime(2000, 9, 14)
     fam.husbandObject.birthDateObject = datetime(1996, 9, 14)
     fam.marriageDateObject = datetime(2013, 9, 14)
     US10_check_marriage_after_14_anomaly(fam)
     self.assertEqual(len(fam.anomalies), 1)
     self.assertEqual(fam.anomalies, ["Wife married before 14 anomaly"])
示例#5
0
 def test_bothOlderThan14(self):
     wife = Individual("I1")
     husband = Individual("I2")
     fam = Family("F1")
     fam.wifeObject = wife
     fam.husbandObject = husband
     fam.wifeObject.birthDateObject = datetime(1992, 9, 14)
     fam.husbandObject.birthDateObject = datetime(1995, 9, 14)
     fam.marriageDateObject = datetime(2013, 9, 14)
     US10_check_marriage_after_14_anomaly(fam)
     self.assertEqual(len(fam.anomalies), 0)
     self.assertEqual(fam.anomalies, [])
 def test_BirthAfterMarriage(self):
     husband = Individual("I1")
     wife = Individual("I2")
     fam = Family("F1")
     husband.birthDateObject = datetime(2020, 2, 1)
     wife.birthDateObject = datetime(2020, 5, 1)
     fam.husbandObject = husband
     fam.wifeObject = wife
     fam.marriageDateObject = datetime(1999, 12, 31)
     US02_birth_before_marriage_error(fam)
     self.assertEqual(len(fam.errors), 1)
     self.assertEqual(fam.errors[0], "Marriage occured before birth date")
 def test_BirthBeforeMarriage(self):
     husband = Individual("I1")
     wife = Individual("I2")
     fam = Family("F1")
     husband.birthDateObject = datetime(1977, 2, 1)
     wife.birthDateObject = datetime(1977, 2, 1)
     fam.husbandObject = husband
     fam.wifeObject = wife
     fam.marriageDateObject = datetime(2020, 12, 31)
     US02_birth_before_marriage_error(fam)
     self.assertEqual(len(fam.errors), 0)
     self.assertEqual(fam.errors, [])
 def test_BothAlive(self):
     husband = Individual("I9")
     wife = Individual("I10")
     testFam = Family("F5")
     testFam.divorced = True
     testFam.husbandId = husband.Id
     testFam.husbandObject = husband
     testFam.wifeId = wife.Id
     testFam.wifeObject = wife
     testFam.divorceDateObject = datetime(2000, 1, 1)
     US06_check_divorce_before_spouse_death_error(testFam)
     self.assertEqual(len(testFam.errors), 0)
     self.assertEqual(testFam.errors, [])
示例#9
0
 def test_father80YearsOlderThanKid(self):
     wife = Individual("I1")
     husband = Individual("I2")
     child = Individual("I3")
     fam = Family("F1")
     fam.husbandObject = husband
     fam.wifeObject = wife
     fam.wifeObject.birthDateObject = datetime(1995, 9, 14)
     fam.husbandObject.birthDateObject = datetime(1900, 9, 14)
     fam.childrenObjects.append(child)
     child.birthDateObject = datetime(2000, 2, 2)
     US14_Parents_not_too_old(fam)
     self.assertEqual(len(fam.anomalies), 1)
     self.assertEqual(fam.anomalies,
                      ["Father is 80 years older than child/ren"])
 def test_people_over_30_one_married(self):
     indiv1 = self.indiv1
     indiv2 = self.indiv2
     indiv3 = Individual("I3")
     indiv1.age = 45
     indiv2.age = 34
     indiv3.age = 36
     individuals = self.individuals
     individuals.append(indiv3)
     fam = Family("F1")
     fam.husbandObject = indiv1
     fam.wifeObjecet = indiv3
     indiv1.spouseFamilyObjects.append(fam)
     indiv3.spouseFamilyObjects.append(fam)
     self.assertEqual(US34_list_singles(individuals), [indiv2])
 def test_DeadHusband_ValidDate(self):
     husband = Individual("I1")
     wife = Individual("I2")
     testFam = Family("F1")
     testFam.divorced = True
     testFam.husbandId = husband.Id
     testFam.husbandObject = husband
     testFam.wifeId = wife.Id
     testFam.wifeObject = wife
     husband.alive = False
     husband.deathDateObject = datetime(2000, 1, 1)
     testFam.divorceDateObject = datetime(1999, 12, 31)
     US06_check_divorce_before_spouse_death_error(testFam)
     self.assertEqual(len(testFam.errors), 0)
     self.assertEqual(testFam.errors, [])
 def test_DeadWife_InvalidDate(self):
     husband = Individual("I7")
     wife = Individual("I8")
     testFam = Family("F4")
     testFam.divorced = True
     testFam.husbandId = husband.Id
     testFam.husbandObject = husband
     testFam.wifeId = wife.Id
     testFam.wifeObject = wife
     wife.alive = False
     wife.deathDateObject = datetime(1999, 12, 31)
     testFam.divorceDateObject = datetime(2000, 1, 1)
     US06_check_divorce_before_spouse_death_error(testFam)
     self.assertEqual(len(testFam.errors), 1)
     self.assertEqual(testFam.errors[0],
                      "Divorce date is after wife death date")