def test5(self): ged = self.generate_fam_2(husband=('01 JAN 1900', None), wife=('01 JAN 1910', None), child=('01 JAN 1981', None)) fams, indis = proj.parse_ged_data(ged) output = validation.validate_parent_age(fams, indis) self.assertEqual(output, [ (('I1_1', 'Husband id=I1_1 in family id=F1 was born over 80 years before child id=I1_3.' )), ('I1_2', 'Wife id=I1_2 in family id=F1 was born over 60 years before child id=I1_3.' ) ])
def test_multi_family(self): ged1 = self.generate_fam_1(marriage='01 JAN 2000', birth='02 JAN 2000', id=1) ged2 = self.generate_fam_1(marriage='01 JAN 2010', birth='01 JAN 2009', id=2) fams, indis = proj.parse_ged_data(ged1 + ged2) output = validation.validate_marriage_before_child(fams, indis) bad_fams = [o[0] for o in output] self.assertTrue('F2' in bad_fams) self.assertEqual(len(bad_fams), 1)
def test_fail2(self): ged = self.generate_fam_1( husbandName1="Alex", wifeName1="Meg", marriage1="02 JAN 2000", husbandName2="Alex", wifeName2="Meg", marriage2="02 JAN 2000", ) fams, indis = proj.parse_ged_data(ged) output = validation.validate_different_marriage(fams, indis) self.assertEqual(output, [( 'F1_1', 'Family id=F1_1 shares spouse names and marriage date with family id=F1_2' )])
def test_bad_6(self): ged = self.generate_fam_1( marriage="01 JAN 2000", births=[ "25 DEC 2020", "25 DEC 2020", "25 DEC 2020", "25 DEC 2020", "25 DEC 2020", "25 DEC 2020" ] ) fams, indis = proj.parse_ged_data(ged) output = validation.list_all_multiple_births(fams, indis) self.assertEqual(output, ['I1_3', 'I1_4', 'I1_5', 'I1_6', 'I1_7', 'I1_8'])
def test_ok_6(self): ged = self.generate_fam_1( marriage="01 JAN 2000", births=[ "25 DEC 2020", "25 DEC 2021", "25 DEC 2022", "25 DEC 2023", "25 DEC 2024", "25 DEC 2025" ] ) fams, indis = proj.parse_ged_data(ged) output = validation.list_all_multiple_births(fams, indis) self.assertEqual(output, [])
def test_fail2(self): ged = self.generate_fam_1( birth1='01 JAN 1900', name1='John Apple', birth2='01 JAN 2000', name2='John Apple', birth3='01 JAN 2000', name3='John Apple', birth4='01 JAN 2000', name4='John Apple', ) fams, indis = proj.parse_ged_data(ged) output = validation.validate_unique_family_member_data(fams, indis) self.assertEqual(output, [( 'I1_3', 'Individual id=I1_3 shares name and birth date with individual id=I1_4' )])
def test_ok_duo6(self): ged1 = self.generate_fam_1(marriage="01 JAN 2000", births=[ "25 DEC 2020", "25 DEC 2021", "25 DEC 2022", "25 DEC 2023", "25 DEC 2024", "25 DEC 2025" ]) ged2 = self.generate_fam_1(marriage="01 JAN 2000", births=[ "25 DEC 2020", "25 DEC 2021", "25 DEC 2022", "25 DEC 2023", "25 DEC 2024", "25 DEC 2025" ], id=2) fams, indis = proj.parse_ged_data(ged1 + ged2) output = validation.validate_no_sextuples(fams, indis) self.assertEqual(output, [])
def test_multifam(self): ged1 = self.generate_fam_1( birth1='01 JAN 1900', name1='A A', birth2='01 JAN 2000', name2='A A', birth3='01 JAN 2011', name3='A A', birth4='01 JAN 2012', name4='A A', ) ged2 = self.generate_fam_1( birth1='01 JAN 2900', name1='B B', birth2='01 JAN 2900', name2='B B', birth3='01 APR 3012', name3='B B', birth4='01 FEB 3012', name4='B B', id=2) fams, indis = proj.parse_ged_data(ged1 + ged2) ans = {'F1': ['I1_3', 'I1_4'], 'F2': ['I2_4', 'I2_3']} for fid in ans: self.assertEqual(validation.sort_siblings_decreasing_age(fid, fams, indis), ans[fid])
def test_multi_fam_bad_death(self): ged1 = self.generate_fam_2( husband=('I1', None, None), wife=('I2', None, '01 JAN 2012'), marriage=('01 JAN 2011', None), id=1, husb_fams=[2] ) ged2 = self.generate_fam_2( husband=('I1', None, None), wife=('I3', None, None), marriage=('01 JUL 2011', '01 JAN 2014'), id=2, define_husband=False ) fams, indis = proj.parse_ged_data(ged1 + ged2) output = validation.validate_no_bigamy(fams, indis) self.assertEqual(output, [('I1', 'Individual id=I1 was in two or more marriages at the same time')])
def test_multi_fam_good(self): ged1 = self.generate_fam_2( husband=('I1', None, None), wife=('I2', None, None), marriage=('01 JAN 2011', '01 JAN 2012'), id=1, husb_fams=[2] ) ged2 = self.generate_fam_2( husband=('I1', None, None), wife=('I3', None, None), marriage=('01 JAN 2013', '01 JAN 2014'), id=2, define_husband=False ) fams, indis = proj.parse_ged_data(ged1 + ged2) output = validation.validate_no_bigamy(fams, indis) self.assertEqual(output, [])
def test_bad_duo6(self): ged1 = self.generate_fam_1(marriage="01 JAN 2000", births=[ "25 DEC 2020", "25 DEC 2020", "25 DEC 2020", "25 DEC 2020", "25 DEC 2020", "25 DEC 2020" ]) ged2 = self.generate_fam_1(marriage="01 JAN 2000", births=[ "25 DEC 2020", "25 DEC 2020", "25 DEC 2020", "25 DEC 2020", "25 DEC 2020", "25 DEC 2020" ], id=2) fams, indis = proj.parse_ged_data(ged1 + ged2) output = validation.validate_no_sextuples(fams, indis) self.assertEqual( output, [('F1', 'Family id=F1 has more than 5 children born together'), ('F2', 'Family id=F2 has more than 5 children born together')])
def test_ok_0(self): ged = self.generate_fam_1(marriage="01 JAN 2000", births=[]) fams, indis = proj.parse_ged_data(ged) output = validation.validate_no_excessive_siblings(fams, indis) self.assertEqual(output, [])
def test3(self): ged = self.generate_fam_1(birth='15 JAN 2000', death='15 JAN 2000') fams, indis = proj.parse_ged_data(ged) output = validation.validate_birth_before_death(fams, indis) self.assertEqual(output, [])
def test4(self): ged = self.generate_fam_1(birth='15 JAN 2000', death='1 MAR 1900') fams, indis = proj.parse_ged_data(ged) output = validation.validate_birth_before_death(fams, indis) self.assertEqual(output, [('I1_2', 'Person id=I1_2 has death before birth.')])
def test5(self): ged = self.generate_fam_1(birth='15 APR 1962', death='3 MAY 1974') fams, indis = proj.parse_ged_data(ged) output = validation.validate_birth_before_death(fams, indis) self.assertEqual(output, [])
def test_married_after_death_3(self): ged = self.generate_fam_1(marriage='01 JAN 2010', birth='01 JAN 1950', divorce='05 JAN 2020', death='31 DEC 2009') fams, indis = proj.parse_ged_data(ged) output = validation.validate_marriage_before_death(fams, indis) self.assertEqual(output, [('F1', 'Family id=F1 has marriage after death of partner')])
def test_same_date(self): ged = self.generate_fam_1(marriage='01 JAN 2010', birth='01 JAN 2010') fams, indis = proj.parse_ged_data(ged) output = validation.validate_marriage_before_child(fams, indis) self.assertEqual(output, [])
def test4(self): ged = self.generate_fam_1('01 JAN 2010', '01 JAN 2011') fams, indis = proj.parse_ged_data(ged) output = validation.validate_sibling_births(fams, indis) self.assertEqual(output, [])
def test_none(self): ged = self.generate_fam_1(marriage="01 JAN 2000", births=[]) fams, indis = proj.parse_ged_data(ged) output = validation.validate_no_sextuples(fams, indis) self.assertEqual(output, [])
def test_ok_dates(self): ged = self.generate_fam_1(marriage='01 JAN 2010', birth='01 JAN 2011') fams, indis = proj.parse_ged_data(ged) output = validation.validate_dates_before_current(fams, indis) self.assertEqual(output, [])
def test_bad_dates(self): ged = self.generate_fam_1(marriage='01 JAN 4010', birth='07 FEB 2102') fams, indis = proj.parse_ged_data(ged) output = validation.validate_dates_before_current(fams, indis) self.assertEqual(output, [('I1_3', 'Birthday 2102-02-07 occurs in the future'), ('F1', 'Marriage 4010-01-01 occurs in the future')])
def test_married_before_death_3(self): ged = self.generate_fam_1(marriage='01 JAN 1970', birth='01 JAN 1950', divorce='05 JAN 2020', death='01 JAN 2040') fams, indis = proj.parse_ged_data(ged) output = validation.validate_marriage_before_death(fams, indis) self.assertEqual(output, [])