def test_BirthBeforeDeath(self): indiv = Individual("I1") indiv.alive = False indiv.birthDateObject = datetime(1999, 12, 31) indiv.deathDateObject = datetime(2000, 1, 1) US03_check_birth_before_death_error(indiv) self.assertEqual(len(indiv.errors), 0) self.assertEqual(indiv.errors, [])
def test_BothDead_ValidDate(self): husband = Individual("I11") wife = Individual("I12") testFam = Family("F6") 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) wife.alive = False wife.deathDateObject = datetime(2000, 1, 2) 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_BothDead_InvalidWifeDeathDate(self): husband = Individual("I15") wife = Individual("I16") testFam = Family("F8") 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) wife.alive = False wife.deathDateObject = datetime(1999, 12, 30) testFam.divorceDateObject = datetime(1999, 12, 31) 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")
def test_birthDate_before_mother_death(self): wife = Individual("I2") wife.alive = False wife.deathDateObject = datetime(2005, 3, 4) fam = Family("F1") fam.wifeObject = wife child1 = Individual("I3") child1.birthDateObject = datetime(2001, 1, 1) fam.childrenObjects.append(child1) US08_check_child_birth_before_mother_death_error(fam) self.assertEqual(len(fam.errors), 0) self.assertEqual(fam.errors, [])
def test_1_birthDate_before_mother_death_1_after(self): wife = Individual("I2") wife.alive = False wife.deathDateObject = datetime(2019, 3, 4) fam = Family("F1") fam.wifeObject = wife child1 = Individual("I3") child1.birthDateObject = datetime(2001, 1, 1) fam.childrenObjects.append(child1) child2 = Individual("I4") child2.birthDateObject = datetime(2020, 1, 1) fam.childrenObjects.append(child2) US08_check_child_birth_before_mother_death_error(fam) self.assertEqual(len(fam.errors), 1) self.assertEqual(fam.errors, ["Child born after death of mother"])
def test_Alive(self): indiv = Individual("I1") indiv.alive = True US03_check_birth_before_death_error(indiv) self.assertEqual(len(indiv.errors), 0) self.assertEqual(indiv.errors, [])