def test_sons_and_daughters(self): testFam1 = self.testFam1 son1 = Individual("I2") son1.gender = 'M' son1.name = "Jake /Doe/" testFam1.childrenObjects.append(son1) son2 = Individual("I3") son2.gender = 'M' son2.name = "John /Smith/" testFam1.childrenObjects.append(son2) son3 = Individual("I4") son3.gender = 'M' son3.name = "Jim /Brown/" testFam1.childrenObjects.append(son3) daughter1 = Individual("I5") daughter1.gender = 'F' daughter1.name = "Jane /Smith/" testFam1.childrenObjects.append(daughter1) daughter2 = Individual("I6") daughter2.gender = 'F' daughter2.name = "Jodi /Doe/" testFam1.childrenObjects.append(daughter2) US18_male_last_names_anomaly(testFam1) self.assertEqual(len(testFam1.anomalies), 2) self.assertEqual( testFam1.anomalies[1], "Males of the same family should have the same last name")
def test_son_same_name(self): testFam1 = self.testFam1 son = Individual("I2") son.gender = 'M' son.name = "Jake /Doe/" testFam1.childrenObjects.append(son) US18_male_last_names_anomaly(testFam1) self.assertEqual(len(testFam1.anomalies), 0) self.assertEqual(testFam1.anomalies, [])
def test_no_son(self): testFam1 = self.testFam1 daughter = Individual("I2") daughter.gender = 'F' daughter.name = "Jane /Smith/" testFam1.childrenObjects.append(daughter) US18_male_last_names_anomaly(testFam1) self.assertEqual(len(testFam1.anomalies), 0) self.assertEqual(testFam1.anomalies, [])
def test_son_different_name(self): testFam1 = self.testFam1 son = Individual("I2") son.gender = 'M' son.name = "John /Smith/" testFam1.childrenObjects.append(son) US18_male_last_names_anomaly(testFam1) self.assertEqual(len(testFam1.anomalies), 1) self.assertEqual( testFam1.anomalies[0], "Males of the same family should have the same last name")
def test_samename_different_birthday(self): husband = self.husband husband1 = Individual("I3") husband.name = "Mark Ass Colins" husband1.name = "Mark Ass Colins" husband.birthDateString = "1991,10,23" husband1.birthDateString = "1990,10,24" individuals = [husband, husband1] US25_unique_birthday_and_name(individuals) self.assertEqual(len(husband1.errors), 0) self.assertEqual(husband1.errors, [])
def test_same_name_and_birthday(self): husband = self.husband husband1 = Individual("I3") husband.name = "Mark Ass Colins" husband1.name = "Mark Ass Colins" husband.birthDateString = "1990,10,23" husband1.birthDateString = "1990,10,23" individuals = [husband, husband1] errorMsg = "There are 2 people with the same name and birthday" US25_unique_birthday_and_name(individuals) self.assertEqual(len(husband.errors), 1) self.assertEqual(husband.errors, [errorMsg])