示例#1
0
 def test_list_living_single_us31(self):
     dict_indi, dict_fam = parse_gedcom(PATH)
     indi_list = build_individual(dict_indi)
     list_result = list_living_single_us31(indi_list)
     self.assertEqual(list_result, [
         '014I03', '014I04', '014I05', '014I06', '014I07', '014I08',
         '031I03'
     ])
示例#2
0
    def test_US03(self):
        path = "C:\\project05\\test.ged"
        m, n = parse_gedcom(path)

        with patch('builtins.print') as mocked_print:
            birth_b_death_us03(build_individual(m))
            mocked_print.assert_called_with(
                "Error: INDIVITUAL: US03 birth before death:line 5 and 9: I01: 5 JUL 1950 isn't before 31 DEC 1949"
            )
示例#3
0
def build_dictionary(sum):
    dict_indi = []
    dict_fam = []
    for item in sum:
        if item[0][0] == 'INDI':
            feat_IND = defaultdict(lambda: 'N/A')
            fams_s = []
            famc_s = []
            for q in item:
                if q[0] == 'FAMC':

                    famc_s.append((q[1], q[2]))

                    feat_IND['FAMC'] = famc_s
                    """ 
                    collect famc in indi level and put them into famc_s set
                    """
                elif q[0] == 'FAMS':

                    fams_s.append((q[1], q[2]))
                    feat_IND['FAMS'] = fams_s
                    """
                    collect fams in indi level and put them into fams_s set
                    """
                else:
                    feat_IND[q[0]] = (q[1], q[2])
            dict_indi.append(feat_IND)
            """ put feat_IND into the result dictionary dict_indi """
        elif item[0][0] == 'FAM':
            feat_FAM = defaultdict(lambda: 'N/A')
            child_s = []
            for q in item:
                if q[0] == 'CHIL':

                    child_s.append((q[1], q[2]))
                    feat_FAM['CHIL'] = child_s
                    """
                    collect children in fam level and put them into child_s set
                    """
                else:
                    feat_FAM[q[0]] = (q[1], q[2])
            dict_fam.append(feat_FAM)
            """ put feat_FAM into the result dictionary dict_fam """

    if len(dict_indi) < 5000 and len(dict_fam) < 1000:
        indi_list = build_individual(dict_indi)
        fam_list = build_family(dict_fam, indi_list)
        individual_table(indi_list)
        family_table(fam_list)
        verification(indi_list, fam_list)
        output_errors_indi(indi_list)
        output_errors_fam(fam_list)
        return dict_indi, dict_fam
    else:
        raise ValueError(f"Data overflow")
示例#4
0
def main():
    path = ""
    while len(path) == 0:
        path = input("Please enter your GEDCOM file path:\n")

    dict_indi, dict_fam = parse_gedcom(path)
    indi_list = build_individual(dict_indi)
    fam_list = build_family(dict_fam, indi_list)
    print(individual_table(indi_list))
    family_table(fam_list)
    verification(indi_list, fam_list)
    output_errors_indi(indi_list)
    output_errors_fam(fam_list)
示例#5
0
    def test_include_individual_ages_us27(self):
        dict_indi, dict_fam = parse_gedcom(PATH)
        indi_list = build_individual(dict_indi)
        tb = individual_table(indi_list)
        l_age = []
        for row in tb:
            row.border = False
            row.header = False
            l_age.append(row.get_string(fields=["Age"]).strip())

        self.assertEqual(tb.field_names,
                         ['ID', 'Name', 'Gender', 'Birthday', 'Alive', 'Death', 'Child', 'Spouse', 'Age'])
        self.assertEqual(l_age, ['death age: 0', '69', '51', '51', '51', '51', '51', '51', 'death age: 283',
                                 '69', '51', '-2', '25', '21', 'death age: 21', '47', '45', '22', '19', '17'])
def build_individual_list(path):
    return build_individual(parse_gedcom(path)[0])
示例#7
0
 def test_List_upcoming_birthdays_us38(self):
     dict_indi, dict_fam = parse_gedcom(PATH)
     indi_list = build_individual(dict_indi)
     list_result = list_birthday_recent(indi_list)
     self.assertEqual(list_result, ['038I02', '038I05'])