Exemple #1
0
    def test_birth_before_death_of_parents(self):
        """ Unit test for birth birth_before_death_of_parents"""

        fail_file_father = FAIL_DIR + "birth_before_death" \
            + "_of_parents_FATHER.ged"
        fail_file_mother = FAIL_DIR + "birth_before_death" \
            + "_of_parents_MOTHER.ged"
        pass_file = PASS_DIR + "birth_before_death_of_parents.ged"

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(
                birth_before_death_of_parents(individuals, families))
        else:
            print "!!birth_before_death_of_parents acceptance file not found"

        if os.path.exists(fail_file_father):
            individuals, families = parse_ged(fail_file_father)
            self.assertFalse(
                birth_before_death_of_parents(individuals, families))
        else:
            print "!!birth_before_death_of_parents acceptance file not found"

        if os.path.exists(fail_file_mother):
            individuals, families = parse_ged(fail_file_mother)
            self.assertFalse(
                birth_before_death_of_parents(individuals, families))
        else:
            print "!!birth_before_death_of_parents acceptance file not found"
Exemple #2
0
    def test_marriage_before_divorce(self):
        """ Unit test for marriage_before_divorce """

        fail_file = FAIL_DIR + "marriage_before_divorce.ged"
        pass_file = PASS_DIR + "marriage_before_divorce.ged"

        if os.path.exists(fail_file) and os.path.exists(pass_file):
            _, families = parse_ged(pass_file)
            self.assertTrue(marriage_before_divorce(families))
            _, families = parse_ged(fail_file)
            self.assertFalse(marriage_before_divorce(families))
        else:
            print "!!marriage_before_divorce acceptance file not found"
    def test_marriage_before_divorce(self):
        """ Unit test for marriage_before_divorce """

        fail_file = FAIL_DIR + "marriage_before_divorce.ged"
        pass_file = PASS_DIR + "marriage_before_divorce.ged"

        if os.path.exists(fail_file) and os.path.exists(pass_file):
            _, families = parse_ged(pass_file)
            self.assertTrue(marriage_before_divorce(families))
            _, families = parse_ged(fail_file)
            self.assertFalse(marriage_before_divorce(families))
        else:
            print "!!marriage_before_divorce acceptance file not found"
Exemple #4
0
    def test_dates_before_current(self):
        """ Unit test for dates_before_current"""

        acceptf = "date_before_current.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(fail_file) and os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(dates_before_current(individuals, families))
            individuals, families = parse_ged(fail_file)
            self.assertFalse(dates_before_current(individuals, families))
        else:
            print "!!test_date_before_current acceptance file not found"
    def test_divorce_before_death(self):
        """ Unit test for divorce_before_death """

        acceptf = "divorce_before_death.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(fail_file) and os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(divorce_before_death(individuals, families))
            individuals, families = parse_ged(fail_file)
            self.assertFalse(divorce_before_death(individuals, families))
        else:
            print "!!test_divorce_before_death acceptance file not found"
    def test_birth_before_marriage(self):
        """ Unit test for birth_before_marriage"""

        acceptf = "birth_before_marriage.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(fail_file) and os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(birth_before_marriage(individuals, families))
            individuals, families = parse_ged(fail_file)
            self.assertFalse(birth_before_marriage(individuals, families))
        else:
            print "!!test_marriage_before_death acceptance file not found"
Exemple #7
0
    def test_birth_before_death(self):
        """ Unit test for birth_before_death """

        acceptf = "birth_before_death.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(fail_file) and os.path.exists(pass_file):
            individuals, _ = parse_ged(pass_file)
            self.assertTrue(birth_before_death(individuals))
            individuals, _ = parse_ged(fail_file)
            self.assertFalse(birth_before_death(individuals))
        else:
            print "!!test_birth_before_death acceptance file not found"
    def test_fewer_than_fifteen_siblings(self):
        """ Unit test for fewer_than_fifteen_siblings"""

        acceptf = "fewer_than_fifteen_siblings.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(fewer_than_fifteen_siblings(individuals, families))
        else:
            print "!!fewer_than_fifteen_siblings acceptance file not found"
        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(fewer_than_fifteen_siblings(individuals, families))
        else:
            print "!!fewer_than_fifteen_siblings acceptance file not found"
    def test_sibling_spacing(self):
        """ Unit test for sibling_spacing"""

        acceptf = "sibling_spacing.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(sibling_spacing(individuals, families))
        else:
            print "!!sibling_spacing acceptance file not found"
        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(sibling_spacing(individuals, families))
        else:
            print "!!sibling_spacing acceptance file not found"
    def test_multiple_births_less_5(self):
        """ Unit test for multiple_births_less_5"""

        acceptf = "multiple_births_less_5.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(multiple_births_less_5(individuals, families))
        else:
            print "!!multiple_births_less_5 acceptance file not found"
        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(multiple_births_less_5(individuals, families))
        else:
            print "!!multiple_births_less_5 acceptance file not found"
    def test_no_marriage_to_decendants(self):
        """ Unit test for no_marriage_to_decendants """

        acceptf = "no_marriage_to_decendants.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(no_marriage_to_decendants(individuals, families))
        else:
            print "!!no_marriage_to_decendants acceptance file not found"
        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(no_marriage_to_decendants(individuals, families))
        else:
            print "!!no_marriage_to_decendants file not found"
Exemple #12
0
    def test_multiple_births_less_5(self):
        """ Unit test for multiple_births_less_5"""

        acceptf = "multiple_births_less_5.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(multiple_births_less_5(individuals, families))
        else:
            print "!!multiple_births_less_5 acceptance file not found"
        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(multiple_births_less_5(individuals, families))
        else:
            print "!!multiple_births_less_5 acceptance file not found"
Exemple #13
0
    def test_no_marriage_to_decendants(self):
        """ Unit test for no_marriage_to_decendants """

        acceptf = "no_marriage_to_decendants.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(no_marriage_to_decendants(individuals, families))
        else:
            print "!!no_marriage_to_decendants acceptance file not found"
        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(no_marriage_to_decendants(individuals, families))
        else:
            print "!!no_marriage_to_decendants file not found"
Exemple #14
0
    def test_sibling_spacing(self):
        """ Unit test for sibling_spacing"""

        acceptf = "sibling_spacing.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(sibling_spacing(individuals, families))
        else:
            print "!!sibling_spacing acceptance file not found"
        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(sibling_spacing(individuals, families))
        else:
            print "!!sibling_spacing acceptance file not found"
Exemple #15
0
    def test_no_bigamy(self):
        """ Unit test for no_bigamy """

        acceptf = "no_bigamy.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(no_bigamy(individuals, families))
        else:
            print "!!no_bigamy acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(no_bigamy(individuals, families))
        else:
            print "!!no_bigamy acceptance file not found"
Exemple #16
0
    def test_parents_not_too_old(self):
        """ Unit test for test_parents_not_too_old """

        acceptf = "parents_not_too_old.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(parents_not_too_old(individuals, families))
        else:
            print "!!parents_not_too_old acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(parents_not_too_old(individuals, families))
        else:
            print "!!parents_not_too_old acceptance file not found"
    def test_no_bigamy(self):
        """ Unit test for no_bigamy """

        acceptf = "no_bigamy.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(no_bigamy(individuals, families))
        else:
            print "!!no_bigamy acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(no_bigamy(individuals, families))
        else:
            print "!!no_bigamy acceptance file not found"
Exemple #18
0
    def test_age_less_150(self):
        """ Unit test for age_less_150 """

        acceptf = "age_less_150.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, _ = parse_ged(pass_file)
            self.assertTrue(age_less_150(individuals))
        else:
            print "!!age_less_150 acceptance file not found"

        if os.path.exists(fail_file):
            individuals, _ = parse_ged(fail_file)
            self.assertFalse(age_less_150(individuals))
        else:
            print "!!age_less_150 acceptance file not found"
    def test_age_less_150(self):
        """ Unit test for age_less_150 """

        acceptf = "age_less_150.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, _ = parse_ged(pass_file)
            self.assertTrue(age_less_150(individuals))
        else:
            print "!!age_less_150 acceptance file not found"

        if os.path.exists(fail_file):
            individuals, _ = parse_ged(fail_file)
            self.assertFalse(age_less_150(individuals))
        else:
            print "!!age_less_150 acceptance file not found"
    def test_correct_gender_for_role(self):
        """ Unit test for correct_gender_for_role """

        acceptf = "correct_gender_for_role.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(correct_gender_for_role(individuals, families))
        else:
            print "!!correct_gender_for_role acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(correct_gender_for_role(individuals, families))
        else:
            print "!!correct_gender_for_role acceptance file not found"
    def test_unique_ids(self):
        """ Unit test for unique_ids """

        acceptf = "unique_ids.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(unique_ids(individuals, families))
        else:
            print "!!unique_ids acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(unique_ids(individuals, families))
        else:
            print "!!unique_ids acceptance file not found"
    def test_male_last_names(self):
        """ Unit test for male_last_names """

        acceptf = "male_last_names.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(male_last_names(individuals, families))
        else:
            print "!!male_last_names acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(male_last_names(individuals, families))
        else:
            print "!!male_last_names acceptance file not found"
    def test_parents_not_too_old(self):
        """ Unit test for test_parents_not_too_old """

        acceptf = "parents_not_too_old.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(parents_not_too_old(individuals, families))
        else:
            print "!!parents_not_too_old acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(parents_not_too_old(individuals, families))
        else:
            print "!!parents_not_too_old acceptance file not found"
Exemple #24
0
    def test_male_last_names(self):
        """ Unit test for male_last_names """

        acceptf = "male_last_names.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(male_last_names(individuals, families))
        else:
            print "!!male_last_names acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(male_last_names(individuals, families))
        else:
            print "!!male_last_names acceptance file not found"
Exemple #25
0
    def test_unique_ids(self):
        """ Unit test for unique_ids """

        acceptf = "unique_ids.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(unique_ids(individuals, families))
        else:
            print "!!unique_ids acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(unique_ids(individuals, families))
        else:
            print "!!unique_ids acceptance file not found"
Exemple #26
0
    def test_correct_gender_for_role(self):
        """ Unit test for correct_gender_for_role """

        acceptf = "correct_gender_for_role.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(correct_gender_for_role(individuals, families))
        else:
            print "!!correct_gender_for_role acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(correct_gender_for_role(individuals, families))
        else:
            print "!!correct_gender_for_role acceptance file not found"
Exemple #27
0
    def test_fewer_than_fifteen_siblings(self):
        """ Unit test for fewer_than_fifteen_siblings"""

        acceptf = "fewer_than_fifteen_siblings.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(fewer_than_fifteen_siblings(individuals, families))
        else:
            print "!!fewer_than_fifteen_siblings acceptance file not found"
        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(fewer_than_fifteen_siblings(
                individuals, families))
        else:
            print "!!fewer_than_fifteen_siblings acceptance file not found"
Exemple #28
0
    def test_birth_before_marriage_of_parents(self):
        """ Unit test for birth_before_marriage_of_parents """

        acceptf = "birth_before_marriage_of_parents.ged"
        fail_file = FAIL_DIR + acceptf
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(
                birth_before_marriage_of_parents(individuals, families))
        else:
            print "!!birth_before_marriage_of_parents " \
                + "acceptance file not found"

        if os.path.exists(fail_file):
            individuals, families = parse_ged(fail_file)
            self.assertFalse(
                birth_before_marriage_of_parents(individuals, families))
        else:
            print "!!birth_before_marriage_of_parents " \
                + "acceptance file not found"
Exemple #29
0
    def test_list_deceased(self):
        """ Unit test for no_marriage_to_decendants """

        acceptf = "list_deceased.ged"
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            people = [x.uid for x in individuals]
            function = [x.uid for x in list_deceased(individuals, families)]
            self.assertEqual(people.sort(), function.sort())
        else:
            print "!!list_deceased acceptance file not found"
    def test_list_living_married(self):
        """ Unit test for no_marriage_to_decendants """

        acceptf = "list_married.ged"
        pass_file = PASS_DIR + acceptf

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            people = [x.uid for x in individuals]
            function = [x.uid for x in list_living_married(individuals, families)]
            self.assertEqual(people.sort(), function.sort())
        else:
            print "!!list_deceased acceptance file not found"
    def test_birth_before_death_of_parents(self):
        """ Unit test for birth birth_before_death_of_parents"""

        fail_file_father = FAIL_DIR + "birth_before_death" + "_of_parents_FATHER.ged"
        fail_file_mother = FAIL_DIR + "birth_before_death" + "_of_parents_MOTHER.ged"
        pass_file = PASS_DIR + "birth_before_death_of_parents.ged"

        if os.path.exists(pass_file):
            individuals, families = parse_ged(pass_file)
            self.assertTrue(birth_before_death_of_parents(individuals, families))
        else:
            print "!!birth_before_death_of_parents acceptance file not found"

        if os.path.exists(fail_file_father):
            individuals, families = parse_ged(fail_file_father)
            self.assertFalse(birth_before_death_of_parents(individuals, families))
        else:
            print "!!birth_before_death_of_parents acceptance file not found"

        if os.path.exists(fail_file_mother):
            individuals, families = parse_ged(fail_file_mother)
            self.assertFalse(birth_before_death_of_parents(individuals, families))
        else:
            print "!!birth_before_death_of_parents acceptance file not found"