def test_validate_no_marriage_to_children(): """ Testing US17 """ # Husband is married to child families = [ Family('F01', wife_id='I02', husband_id='I01', children=['I03']), Family('F02', wife_id='I01', husband_id='I03') ] gedcom = Gedcom(individuals=[], families=families) errors = validation.validate_no_marriage_to_children(gedcom) assert len(errors) == 1 assert errors[ 0] == 'Error: US17: Individiual I01 is married to I03, a child of theirs in Family F01.' # Wife is married to child families = [ Family('F01', wife_id='I01', husband_id='I02', children=['I03']), Family('F02', wife_id='I01', husband_id='I03') ] gedcom = Gedcom(individuals=[], families=families) errors = validation.validate_no_marriage_to_children(gedcom) assert len(errors) == 1 assert errors[ 0] == 'Error: US17: Individiual I01 is married to I03, a child of theirs in Family F01.' # No one is married to child families = [ Family('F01', wife_id='I01', husband_id='I02', children=['I03']) ] gedcom = Gedcom(individuals=[], families=families) errors = validation.validate_no_marriage_to_children(gedcom) assert len(errors) == 0
def test_dates_before_current(): # Marriage date after Today's date individuals = [ Individual('I01', spouse='F01'), Individual('I02', spouse='F01') ] families = [ Family('F01', wife_id='I01', husband_id='I02', married=datetime(2025, 10, 10)) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_dates_before_current(gedcom) assert errors[ 0] == 'Error: US01: The Family F01\'s marriage date 2025-10-10 is after the current date' assert len(errors) == 1 # Divorce date after Today's date individuals = [ Individual('I01', spouse='F01'), Individual('I02', spouse='F01') ] families = [ Family('F01', wife_id='I01', husband_id='I02', married=datetime(2000, 10, 10), divorced=datetime(2025, 10, 10)) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_dates_before_current(gedcom) assert errors[ 0] == 'Error: US01: The Family F01\'s divorce date 2025-10-10 is after the current date' assert len(errors) == 1 # Birthday after Today's date individual = [Individual('I01', birthday=datetime(2025, 10, 10))] gedcom = Gedcom(individuals=individual) errors = validation.validate_dates_before_current(gedcom) assert errors[ 0] == 'Error: US01: The Individual I01\'s birthday 2025-10-10 is after the current date' assert len(errors) == 1 # Deathdate after Today's date individual = [ Individual('I01', birthday=datetime(1999, 10, 10), death=datetime(2025, 10, 10)) ] gedcom = Gedcom(individuals=individual) errors = validation.validate_dates_before_current(gedcom) assert errors[ 0] == 'Error: US01: The Individual I01\'s deathdate 2025-10-10 is after the current date' assert len(errors) == 1
def test_validate_born_before_parents_death(): """ Test US09: Birth before death of parents (and not more than 9 months after death of father) """ # Child born more than 9 months after father's death individuals = [ Individual('I01', birthday=datetime(year=2010, month=10, day=10), child='F01'), Individual('I02', death=datetime(year=2008, month=10, day=10)), Individual('I03') ] families = [ Family('F01', husband_id='I02', wife_id='I03', children=['I01']) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_born_before_parents_death(gedcom) assert len(errors) == 1 assert errors[ 0] == 'Error: US09: Individual I01 born more than 9 months after death of their father, I02, in family F01' # Child born after mother's death individuals = [ Individual('I01', birthday=datetime(year=2010, month=10, day=10), child='F01'), Individual('I02', death=datetime(year=2010, month=8, day=10), spouse='F01'), Individual('I03', spouse='F01') ] families = [ Family('F01', husband_id='I03', wife_id='I02', children=['I01']) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_born_before_parents_death(gedcom) assert len(errors) == 1 assert errors[ 0] == 'Error: US09: Individual I01 born after death of their mother, I02, in family F01' # Child born to parents not dead yet individuals = [ Individual('I01', birthday=datetime(year=2010, month=10, day=10), child='F01'), Individual('I02', spouse='F01'), Individual('I03', spouse='F01') ] families = [ Family('F01', husband_id='I02', wife_id='I03', children=['I01']) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_born_before_parents_death(gedcom) assert len(errors) == 0
def test_check_family_dates(self): fams = {} fam1 = Family('1') fam1.married = '21 APR 1968' fam2 = Family('2') fam2.married = '23 MAY 1959' fam3 = Family('3') fam3.married = '30 NOV 1919' fam3.divorced = '29 JUN 1989' fams['1'] = fam1 fams['2'] = fam2 fams['3'] = fam3 self.assertTrue(util_khalid.check_family_dates(fams))
def test_list_large_age_diff(): """ Test US34: List all couples who were married when the older spouse was more than twice as old as the younger spouse """ # Wife is two times older on wedding day families = [ Family('F01', married=datetime(2000, 1, 1), husband_id='I01', wife_id='I02') ] individuals = [ Individual('I01', name="John Smith", birthday=datetime(1980, 1, 1), spouses=['F01']), Individual('I02', name="Abby Smith", birthday=datetime(1940, 1, 1), spouses=['F01']) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.list_large_age_diff(gedcom) assert len(errors) == 1 assert errors[ 0] == '(I02) Abby Smith was more than two times older than her husband (I01) John Smith when they got married on 2000-01-01' # Husband is two times older on wedding day families = [ Family('F01', married=datetime(2000, 1, 1), husband_id='I01', wife_id='I02') ] individuals = [ Individual('I01', name="John Smith", birthday=datetime(1940, 1, 1), spouses=['F01']), Individual('I02', name="Abby Smith", birthday=datetime(1980, 1, 1), spouses=['F01']) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.list_large_age_diff(gedcom) assert len(errors) == 1 assert errors[ 0] == '(I01) John Smith was more than two times older than his wife (I02) Abby Smith when they got married on 2000-01-01'
def test_list_living_married(): """ Testing US30: List All Living Married """ families = [ Family('F01', married=datetime(2000, 9, 1), husband_id='I01', wife_id='I02') ] individuals = [ Individual('I01', name="John Smith", birthday=datetime(1965, 10, 10), spouses=['F01']), Individual('I02', name="Abby Smith", birthday=datetime(1968, 10, 10), spouses=['F01']) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_list_living_married(gedcom) assert len(errors) == 2 assert errors[0] == 'Living Married: US30: (I01) John Smith' assert errors[1] == 'Living Married: US30: (I02) Abby Smith'
def test_validate_born_during_parents_marriage(): """ Test US08: Birth before marriage of parents (and not more than 9 months after their divorce) """ # Individual born before the marriage of parents individuals = [ Individual('I01', child='F01', birthday=datetime.now() - timedelta(days=1)) ] families = [Family('F01', married=datetime.now())] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_born_during_parents_marriage(gedcom) assert len(errors) == 1 assert errors[ 0] == f'Error: US08: Individual I01 was born before the marriage of their parents in F01' # Indiviudal born after marriage of parents and before their divorce individuals = [ Individual('I01', child='F01', birthday=datetime(year=2010, month=10, day=10)) ] families = [ Family('F01', married=datetime(year=2005, month=10, day=10), divorced=datetime(year=2019, month=10, day=10)) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_born_during_parents_marriage(gedcom) assert len(errors) == 0 # Individual born 9 months after parent's divorce inidividuals = [ Individual('I01', child='F01', birthday=datetime(year=2010, month=10, day=10)) ] families = [Family('F01', divorced=datetime(year=2005, month=10, day=10))] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_born_during_parents_marriage(gedcom) assert len(errors) == 1 assert errors[ 0] == f'Error: US08: Individual I01 was born after the divorce of their parents in F01'
def test_fewer_than_15_sibs(): # Family has more than 15 siblings families = [ Family('F01', wife_id='I01', husband_id='I02', children=(['I01'] * 16)) ] gedcom = Gedcom(individuals=None, families=families) errors = validation.validate_fewer_than_15_sibs(gedcom) assert errors[0] == 'Error: US15: Family F01 has more than 15 siblings' assert len(errors) == 1
def test_validate_unique_first_name_in_family_valid(): families = [ Family('F01', married=datetime(2000, 10, 10), children=['I01', 'I02']) ] individuals = [ Individual('I01', first_name='Morgan'), Individual('I02', first_name='Gordon'), ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_unique_first_name_in_family(gedcom)
def test_validate_unique_families_by_spouses_error_diff_marriage_date_same_names( ): families = [ Family('F01', married=datetime(2000, 10, 10), wife_id='I01', husband_id='I02'), Family('F02', married=datetime(2000, 10, 11), wife_id='I03', husband_id='I04') ] individuals = [ Individual('I01', name='Morgan Freeman', sex='M'), Individual('I02', name='Sarah Freeman', sex='F'), Individual('I03', name='Morgan Freeman', sex='M'), Individual('I04', name='Sarah Freeman', sex='F'), ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_unique_families_by_spouses(gedcom) assert len(errors) == 0
def test_validate_sibling_spacing_less_than_2_days(): families = [ Family('F01', married=datetime(2000, 10, 10), children=['I01', 'I02']) ] individuals = [ Individual('I01', name='Morgan Freeman', birthday=datetime(2010, 1, 1)), Individual('I02', name='David Freeman', birthday=datetime(2010, 1, 2)), ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_sibling_spacing(gedcom) assert len(errors) == 0
def test_validate_no_marriage_to_siblings(): """ Testing US18: No marriage to siblings """ # Husband is married to a sibling families = [ Family('F01', children=['I01', 'I02']), Family('F02', wife_id='I01', husband_id='I02') ] gedcom = Gedcom(individuals=[], families=families) errors = validation.validate_no_marriage_to_siblings(gedcom) assert len(errors) == 2 assert errors[ 0] == 'Error: US18: Individiual I02 is married to I01, a sibling of theirs in Family F01.' assert errors[ 1] == 'Error: US18: Individiual I01 is married to I02, a sibling of theirs in Family F01.' # No one is married to child families = [Family('F01', children=['I01', 'I02'])] gedcom = Gedcom(individuals=[], families=families) errors = validation.validate_no_marriage_to_siblings(gedcom) assert len(errors) == 0
def test_validate_unique_families_by_spouses_error(): families = [ Family('F01', married=datetime(2000, 10, 10), wife_id='I01', husband_id='I02'), Family('F02', married=datetime(2000, 10, 10), wife_id='I03', husband_id='I04') ] individuals = [ Individual('I01', name='Morgan Freeman', sex='M'), Individual('I02', name='Sarah Freeman', sex='F'), Individual('I03', name='Morgan Freeman', sex='M'), Individual('I04', name='Sarah Freeman', sex='F'), ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_unique_families_by_spouses(gedcom) assert len(errors) == 1 assert errors[ 0] == "Error: US24: Families with id F01 and F02 have the same spouses names (Sarah Freeman, Morgan Freeman) and marriage date (2000-10-10 00:00:00)"
def test_validate_unique_first_name_in_family_error(): families = [ Family('F01', married=datetime(2000, 10, 10), children=['I01', 'I02']) ] individuals = [ Individual('I01', first_name='Morgan'), Individual('I02', first_name='Morgan'), ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_unique_first_name_in_family(gedcom) assert len(errors) == 1 assert errors[ 0] == "Error: US25: Family with id F01 has two children with the same first name 'Morgan'"
def test_validate_male_last_names_invalid_last_name_no_father(): families = [ Family('F01', married=datetime(2000, 10, 10), wife_id='I02', children=['I03', 'I04']) ] individuals = [ Individual('I03', first_name='David', last_name='Freeman', sex='M'), Individual('I04', first_name='Mike', last_name='Mike', sex='M') ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_male_last_last_name(gedcom) assert len(errors) == 1 assert errors[ 0] == "Error: US16: Individual I04 last name (Mike) doesn't follow the family last name (Freeman)"
def test_validate_male_last_names_all_last_names_valid(): families = [ Family('F01', married=datetime(2000, 10, 10), husband_id='I01', wife_id='I02', children=['I03', 'I04']) ] individuals = [ Individual('I01', first_name='Morgan', last_name='Freeman'), Individual('I03', first_name='David', last_name='Freeman', sex='M'), Individual("I04", first_name='Sarah', last_name='Freeman', sex="F") ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_male_last_last_name(gedcom) assert len(errors) == 0
def test_marriage_after_divorce(): # Marriage is after divorce individuals = [ Individual('I01', spouse='F01'), Individual('I02', spouse='F01') ] families = [ Family('F01', wife_id='I01', husband_id='I02', married=datetime(2000, 10, 10), divorced=datetime(1999, 10, 10)) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_marriage_after_divorce(gedcom) assert errors[ 0] == 'Error: US04: Family F01 has divorce date 1999-10-10 before marriage date 2000-10-10' assert len(errors) == 1
def test_validate_sibling_spacing_unrealistic(): families = [ Family('F01', married=datetime(2000, 10, 10), children=['I01', 'I02', 'I03']) ] individuals = [ Individual('I01', name='Morgan Freeman', birthday=datetime(2010, 1, 1)), Individual('I02', name='David Freeman', birthday=datetime(2010, 5, 3)), Individual('I03', name='Sarah Freeman', birthday=datetime(2010, 10, 3)) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_sibling_spacing(gedcom) assert len(errors) == 2 assert errors[ 0] == "Error: US13: Child Morgan Freeman (I01) in family F01 has unrealistic birthday gap (122 days) to his sibling David Freeman (I02)" assert errors[ 1] == "Error: US13: Child David Freeman (I02) in family F01 has unrealistic birthday gap (153 days) to his sibling Sarah Freeman (I03)"
def test_marriage_after_fourteen(): # Husband < 14 individuals = [ Individual('I01', spouse='F01', birthday=datetime(2007, 1, 1)), Individual('I02', spouse='F01', birthday=datetime(1997, 6, 18)) ] families = [ Family('F01', husband_id='I01', wife_id='I02', married=datetime(2020, 2, 20)) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_marriage_after_fourteen(gedcom) assert errors[ 0] == 'Error: US10: Spouse I01 in family F01 was married at less than 14 years old, age=13' assert len(errors) == 1 # Wife < 14 individuals = [ Individual('I01', spouse='F01', birthday=datetime(2007, 1, 1)), Individual('I02', spouse='F01', birthday=datetime(1997, 6, 18)) ] families = [ Family('F01', wife_id='I01', husband_id='I02', married=datetime(2020, 2, 20)) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_marriage_after_fourteen(gedcom) assert errors[ 0] == 'Error: US10: Spouse I01 in family F01 was married at less than 14 years old, age=13' assert len(errors) == 1 # Husband + Wife < 14 individuals = [ Individual('I01', spouse='F01', birthday=datetime(2007, 1, 1)), Individual('I02', spouse='F01', birthday=datetime(2007, 1, 1)) ] families = [ Family('F01', wife_id='I01', husband_id='I02', married=datetime(2020, 2, 20)) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_marriage_after_fourteen(gedcom) assert errors[ 0] == 'Error: US10: Spouse I01 in family F01 was married at less than 14 years old, age=13' assert errors[ 1] == 'Error: US10: Spouse I02 in family F01 was married at less than 14 years old, age=13' assert len(errors) == 2 # Husband + Wife > 14 individuals = [ Individual('I01', spouse='F01', birthday=datetime(1997, 6, 18)), Individual('I02', spouse='F01', birthday=datetime(1997, 6, 18)) ] families = [ Family('F01', wife_id='I01', husband_id='I02', married=datetime(2020, 2, 20)) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_marriage_after_fourteen(gedcom) assert len(errors) == 0 # No marriage --> no errors individuals = [ Individual('I01', spouse='F01', birthday=datetime(1997, 6, 18)), Individual('I02', spouse='F01', birthday=datetime(1997, 6, 18)) ] families = [Family('F01', wife_id='I01', husband_id='I02')] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_marriage_after_fourteen(gedcom) assert len(errors) == 0
def test_correct_gender(): # Husband is female or anything other than male families = [ Family('F01', married=datetime(1999, 9, 9), husband_id='I01', wife_id='I02') ] individuals = [ Individual('I01', spouses=['F01'], sex='X'), Individual('I02', spouses=['F01'], sex='F') ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_correct_gender(gedcom) assert errors[0] == 'Error: US21: Husband I01 in Family F01 should be male' assert len(errors) == 1 # Wife is male or anything other than female families = [ Family('F01', married=datetime(1999, 9, 9), husband_id='I01', wife_id='I02') ] individuals = [ Individual('I01', spouses=['F01'], sex='M'), Individual('I02', spouses=['F01'], sex='X') ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_correct_gender(gedcom) assert errors[0] == 'Error: US21: Wife I02 in Family F01 should be female' assert len(errors) == 1 # Both Husband and wife are not male and femalerespectively families = [ Family('F01', married=datetime(1999, 9, 9), husband_id='I01', wife_id='I02') ] individuals = [ Individual('I01', spouses=['F01'], sex='X'), Individual('I02', spouses=['F01'], sex='X') ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_correct_gender(gedcom) assert errors[0] == 'Error: US21: Husband I01 in Family F01 should be male' assert errors[1] == 'Error: US21: Wife I02 in Family F01 should be female' assert len(errors) == 2 # Both Husband and Wife are correct gender families = [ Family('F01', married=datetime(1999, 9, 9), husband_id='I01', wife_id='I02') ] individuals = [ Individual('I01', spouses=['F01'], sex='M'), Individual('I02', spouses=['F01'], sex='F') ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_correct_gender(gedcom) assert len(errors) == 0
def test_corresponding_entries(): def test(individuals, families, input_errors): gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_corresponding_entries(gedcom) for error in errors: assert error in input_errors assert len(errors) == len(input_errors) ### CHILDREN ### # Family lists child that doesn't exist test([], [Family('F01', children=['I01'])], [ 'Error: US26: The family F01 contains child I01, but that individual has no record' ]) # Individual lists family that doesn't exist test([Individual('I01', child='F01')], [], [ 'Error: US26: The individual I01 says they are a child of family F01, but that family has no record' ]) # Individual lists family that doesn't list them test([Individual('I01', child='F01')], [Family('F01')], [ 'Error: US26: The individual I01 says they are a child of family F01, but that family does not list this individual as a child' ]) # Individual lists family as child, family lists another individual as child, other child doesn't exist test([Individual(id='I01', child='F01')], [ Family(id='F01', children=['I02']) ], [ 'Error: US26: The individual I01 says they are a child of family F01, but that family does not list this individual as a child', 'Error: US26: The family F01 contains child I02, but that individual has no record' ]) # Individua lists family as child, family lists another individual as child, other child does not list family test([ Individual(id='I01', child='F01'), Individual(id='I02') ], [Family(id='F01', children=['I02'])], [ 'Error: US26: The individual I01 says they are a child of family F01, but that family does not list this individual as a child', 'Error: US26: The family F01 contains child I02, but that individual does not list this family as a child', ]) # Records line up for one individual one family child test([Individual('I01', child='F01')], [Family('F01', children=['I01'])], []) # Records line up for two individuals one family child test([Individual('I01', child='F01'), Individual('I02', child='F01')], [Family('F01', children=['I01', 'I02'])], []) #### SPOUSES ##### # Individual lists family as spouse, family does not list individual test([Individual('I01', spouses=['F01'])], [Family('F01')], [ 'Error: US26: The individual I01 says they are a spouse of family F01, but that family does not list this individual as a spouse' ]) # Individual lists family as spouse, family lists another individual who does not exist test([Individual('I01', spouses=['F01'])], [ Family('F01', husband_id='I02') ], [ 'Error: US26: The individual I01 says they are a spouse of family F01, but that family does not list this individual as a spouse', 'Error: US26: The family F01 contains spouse I02, but that individual has no record' ]) # Individual lists family as spouse, family lists another individual, other individual doesn't list family test([ Individual('I01', spouses=['F01']), Individual('I02', spouses=['F02']) ], [Family('F01', wife_id='I02')], [ 'Error: US26: The individual I01 says they are a spouse of family F01, but that family does not list this individual as a spouse', 'Error: US26: The family F01 contains spouse I02, but that individual does not list this family as a spouse', 'Error: US26: The individual I02 says they are a spouse of family F02, but that family has no record' ]) # Family lists individual as spouse, individual does not list family test([Individual('I01')], [Family('F01', husband_id='I01')], [ 'Error: US26: The family F01 contains spouse I01, but that individual does not list this family as a spouse' ]) # Family lists individual as spouse, spouse lists another family that does not exist test([Individual('I01', spouses=['F02'])], [ Family('F01', husband_id='I01') ], [ 'Error: US26: The individual I01 says they are a spouse of family F02, but that family has no record', 'Error: US26: The family F01 contains spouse I01, but that individual does not list this family as a spouse' ]) # Family lists individual as spouse, spouse lists another family, other family doesnt list individual test([Individual('I01', spouses=['F02'])], [ Family('F01', husband_id='I01'), Family('F02') ], [ 'Error: US26: The individual I01 says they are a spouse of family F02, but that family does not list this individual as a spouse', 'Error: US26: The family F01 contains spouse I01, but that individual does not list this family as a spouse' ]) # Records line up for one individual one family spouse test([Individual('I01', spouses=['F01'])], [Family('F01', husband_id='I01')], []) test([Individual('I01', spouses=['F01'])], [Family('F01', wife_id='I01')], []) # Records line up for two individuals one family spouse test([ Individual('I01', spouses=['F01']), Individual('I02', spouses=['F01']) ], [Family('F01', husband_id='I01', wife_id='I02')], [])
def test_validate_no_bigamy(): # Spouse 1 and Spouse 2 each don't have another marriage families = [ Family('f01', married=datetime(2000, 10, 10), husband_id='i01', wife_id='i02') ] individuals = [ Individual('i01', spouses=['f01']), Individual('i02', spouses=['f01']) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_no_bigamy(gedcom) assert len(errors) == 0 # Spouse 1 got married to Spouse 3 during still-existing marriage to Spouse 2 families = [ Family('f01', married=datetime(2000, 10, 10), husband_id='i01', wife_id='i02'), Family('f02', married=datetime(2005, 10, 10), husband_id='i01', wife_id='i03') ] individuals = [ Individual('i01', spouses=['f01', 'f02']), Individual('i02', spouses=['f01']), Individual('i03', spouses=['f02']) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_no_bigamy(gedcom) assert errors[ 0] == 'Error: US11: Individual i01 married i03 on 10-10-2005, which was during their marriage to i02' assert len(errors) == 1 # Spouse 1 got married to spouse 3 during marriage to spouse 2 families = [ Family('f01', married=datetime(2000, 10, 10), divorced=datetime(2010, 10, 10), husband_id='i01', wife_id='i02'), Family('f02', married=datetime(2005, 10, 10), husband_id='i01', wife_id='i03') ] individuals = [ Individual('i01', spouses=['f01', 'f02']), Individual('i02', spouses=['f01']), Individual('i03', spouses=['f02']) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_no_bigamy(gedcom) assert errors[ 0] == 'Error: US11: Individual i01 married i03 on 10-10-2005, which was during their marriage to i02' assert len(errors) == 1 # Spouse 1 married Spouse 2, got divorced, and then married Spouse 3 families = [ Family('f01', married=datetime(2000, 10, 10), divorced=datetime(2010, 10, 10), husband_id='i01', wife_id='i02'), Family('f02', married=datetime(2012, 10, 10), husband_id='i01', wife_id='i03') ] individuals = [ Individual('i01', spouses=['f01', 'f02']), Individual('i02', spouses=['f01']), Individual('i03', spouses=['f02']) ] gedcom = Gedcom(individuals=individuals, families=families) errors = validation.validate_no_bigamy(gedcom) assert len(errors) == 0