def test_issue_single_parent(self): ''' Test no issue with a single parent in marriage ''' #No need to check anything, just making sure it works ok. input_file = os.path.join(self.filelocation, "fs-JuarezRuiz.xlsx") getFSfamily(input_file, "spanish_surname", language="es")
def test_empty_excel(self): ''' Test an empty excel from FS ''' input_file = os.path.join(self.filelocation, "fs-Empty.xlsx") fsclass = getFSfamily(input_file) self.assertFalse(fsclass.correct_execution)
def test_not_existing_file(self): ''' Test file not existing ''' input_file = os.path.join(self.filelocation, "fs-DOESNOTEXIST.xls") fsclass = getFSfamily(input_file, naming_convention="spanish_surname") self.assertFalse(fsclass.correct_execution)
def test_fs_with_a_marriage(self): ''' Test a FS file with marriage ''' input_file = os.path.join(self.filelocation, "fs-MartinPerez.xlsx") fsclass = getFSfamily(input_file, naming_convention="spanish_surname", language="es") assert (fsclass.correct_execution) first_profile = fsclass.profiles[0] assert (first_profile.gen_data["name"] == "Tiburcio") second_profile = fsclass.profiles[1] assert (second_profile.gen_data["name"] == "Lucía") married_profile = fsclass.profiles[2] assert (married_profile.gen_data["name"] == "Nicasia") assert (married_profile.gen_data["marriage"][0].get_location() ["place_name"] == "Tudela de Duero") testing_date = datetime.date(1841, 11, 30) assert ( married_profile.gen_data["marriage"][0].get_date() == testing_date) fsclass.create_profiles_in_Geni(SANDBOX_MAIN_ADDRESS) #We check the partner fsclass.related_geni_profiles[0].get_relations() #TODO: add checking when marriage is available in relations for parent_profile in fsclass.parents_geni_profiles: assert (parent_profile.delete_profile()) for partner_profile in fsclass.related_geni_profiles: assert (testing_date == partner_profile.gen_data["marriage"] [0].get_date()) assert (partner_profile.gen_data["surname"] == "González Ruiz") assert (partner_profile.delete_profile()) for data_profile in fsclass.geni_profiles: assert (data_profile.delete_profile())
def test_issue_double_surname_mother_partner(self): ''' Test securing right surname transferred for mother of partner ''' input_file = os.path.join(self.filelocation, "fs-MartinFernandez.xlsx") fsclass = getFSfamily(input_file, "spanish_surname", language="es") assert (fsclass.related_profiles[3].gen_data["surname"] == "de Ayala Martínez")
def test_binfo(self): ''' Test missing surname of partner ''' input_file = os.path.join(self.filelocation, "fs-ArribasRuiz.xlsx") fsclass = getFSfamily(input_file, "spanish_surname", language="es") for prof in fsclass.profiles: assert (prof.gen_data["surname"] == "Arribas Ruiz")
def test_bug_equal_surnames(self): ''' Test parents with same surname not captured ''' input_file = os.path.join(self.filelocation, "fs-NuñezArribas.xlsx") fsclass = getFSfamily(input_file, "spanish_surname", language="es") for prof in fsclass.related_profiles: assert (fsclass.related_profiles[prof].gen_data["surname"] == "Sanz Sanz")
def test_wrong_inputs(self): ''' Test FS reader wrong inputs are detected ''' input_file = os.path.join(self.filelocation, "fs-PotenteAsegurado.xlsx") fsclass = getFSfamily(input_file, naming_convention="wrong_input") self.assertFalse(fsclass.correct_execution) self.assertFalse(fsclass.create_profiles_in_Geni("data")) self.assertFalse(fsclass.create_gedcom_file("myoutput"))
def test_wrong_geni_key_creation(self): ''' Test pyfs breaks if wrong Geni input ''' input_file = os.path.join(self.filelocation, "fs-MartinPerez.xlsx") fsclass = getFSfamily(input_file, naming_convention="spanish_surname", language="es") execution = fsclass.create_profiles_in_Geni(SANDBOX_MAIN_ADDRESS) self.assertFalse(execution)
def test_name_with_particle(self): ''' Test bug of names with particle ''' input_file = os.path.join(self.filelocation, "fs-CaballeroBargas.xlsx") fsclass = getFSfamily(input_file, "spanish_surname", language="es") juan_in = False for prof in fsclass.profiles: if ("juan de" in prof.gen_data["name"].lower()): juan_in = True self.assertFalse(juan_in)
def test_bug_not_identifying_surname_of_partner(self): ''' Test missing surname of partner ''' input_file = os.path.join(self.filelocation, "fs-ZamoraEsteban.xlsx") fsclass = getFSfamily(input_file, "spanish_surname", language="es") assert (fsclass.related_profiles[0].gen_data["surname"] == "Recio de Diego") assert ( fsclass.related_profiles[1].gen_data["surname"] == "Toral Martín") assert (fsclass.parents_profiles[0][0].gen_data["surname"] == "Recio") assert ( fsclass.parents_profiles[0][1].gen_data["surname"] == "de Diego") assert (fsclass.parents_profiles[1][0].gen_data["surname"] == "Toral") assert (fsclass.parents_profiles[1][1].gen_data["surname"] == "Martín")
def test_issue_double_names(self): ''' Test composed names ''' input_file = os.path.join(self.filelocation, "fs-MolpecerezGomez.xls") fsclass = getFSfamily(input_file, naming_convention="spanish_surname") for profile in fsclass.profiles: assert (profile.gen_data["name"] in [ "Eusebio", "Petra", "Román", "Gila", "Segunda", "Julián", "Petra Regalada" ]) os.remove(os.path.join(self.filelocation, "fs-MolpecerezGomez.xlsx")) file_ged = os.path.join(self.filelocation, "fs-MolpecerezGomez.ged") if os.path.exists(file_ged): os.remove(file_ged) #This one will create the gedcomfile fsclass.create_gedcom_file(file_ged) if os.path.exists(file_ged): os.remove(file_ged)
def test_fs_reader_single_person(self): ''' Tests in detail the correct reading of a person ''' input_file = os.path.join(self.filelocation, "fs-PotenteAsegurado-singleperson.xlsx") fsclass = getFSfamily(input_file, "spanish_surname") this_profile = fsclass.profiles[0] assert (fsclass.correct_execution) assert (len(fsclass.profiles) == 1) assert (this_profile.gen_data["gender"] == "M") assert (this_profile.gen_data["name"] == "Wenceslao") assert (this_profile.gen_data["surname"] == "Potente Asegurado") assert (this_profile.gen_data["birth_date"] == datetime.date( 1862, 9, 28)) assert (this_profile.gen_data["accuracy_birth_date"] == "EXACT") assert (this_profile.gen_data["baptism_date"] == datetime.date( 1862, 10, 2)) assert (this_profile.gen_data["accuracy_baptism_date"] == "EXACT") assert (this_profile.gen_data["residence_date"] == datetime.date( 1862, 1, 1)) assert (this_profile.gen_data["accuracy_residence_date"] == "ABOUT") assert (this_profile.gen_data["death_date"] == datetime.date( 1863, 6, 28)) assert (this_profile.gen_data["accuracy_death_date"] == "EXACT") assert (this_profile.gen_data["burial_date"] == datetime.date( 1863, 6, 28)) assert (this_profile.gen_data["accuracy_burial_date"] == "EXACT") assert (this_profile.gen_data["death_place"]["city"] == 'La Parrilla') assert (this_profile.gen_data["birth_place"]["city"] == 'La Parrilla') assert (this_profile.gen_data["residence_place"]["state"] == 'Castile and León') assert (this_profile.gen_data["baptism_place"]["place_name"] == 'Nuestra Señora De Los Remedios') assert (len(this_profile.gen_data["nicknames"])) assert ("Wenceslao Potente" in this_profile.gen_data["nicknames"])
def test_fs_reader(self): ''' Test reading an input file ''' input_file = os.path.join(self.filelocation, "fs-PotenteAsegurado.xlsx") fsclass = getFSfamily(input_file, naming_convention="spanish_surname", language="es") assert (fsclass.correct_execution) assert (fsclass.initial_column == "A") assert (fsclass.initial_row == 6) assert (fsclass.sheet_title == "Sheet0") #Maria Potente Asegurado assert (fsclass.profiles[0].gen_data["birth_date"] == datetime.date( 1853, 9, 8)) assert (fsclass.profiles[0].gen_data["baptism_date"] == datetime.date( 1853, 9, 13)) assert (fsclass.profiles[0].gen_data["burial_date"] == datetime.date( 1853, 9, 30)) assert (fsclass.profiles[0].gen_data["baptism_place"]["city"] == "La Parrilla") assert (fsclass.profiles[0].gen_data["death_place"]["city"] == "La Parrilla") assert (len(fsclass.profiles[0].gen_data["web_ref"]) == 3) assert ( fsclass.profiles[0].gen_data["residence_date"] == datetime.date( 1853, 1, 1)) #Wenceslao Potente Asegurado assert (fsclass.profiles[2].gen_data["birth_date"] == datetime.date( 1862, 9, 28)) assert (fsclass.profiles[2].gen_data["baptism_date"] == datetime.date( 1862, 10, 2)) assert (fsclass.profiles[2].gen_data["death_date"] == datetime.date( 1863, 6, 28)) assert (fsclass.profiles[2].gen_data["burial_date"] == datetime.date( 1863, 6, 28)) assert (fsclass.profiles[2].gen_data["baptism_place"]["city"] == "La Parrilla") assert (fsclass.profiles[2].gen_data["death_place"]["city"] == "La Parrilla") assert (len(fsclass.profiles[2].gen_data["web_ref"]) == 2) assert ( fsclass.profiles[2].gen_data["residence_date"] == datetime.date( 1862, 1, 1)) #Evarista Potente Asegurado assert (fsclass.profiles[4].gen_data["birth_date"] == datetime.date( 1857, 10, 26)) assert (fsclass.profiles[4].gen_data["baptism_date"] == datetime.date( 1857, 11, 1)) assert (fsclass.profiles[4].gen_data["burial_date"] == datetime.date( 1858, 2, 25)) assert (fsclass.profiles[4].gen_data["baptism_place"]["city"] == "La Parrilla") assert (fsclass.profiles[4].gen_data["death_place"]["city"] == "La Parrilla") assert (len(fsclass.profiles[4].gen_data["web_ref"]) == 2) assert ( fsclass.profiles[4].gen_data["residence_date"] == datetime.date( 1857, 1, 1))
Created on 10 sept. 2017 @author: Val This example takes an export from Family search in excel format. This export shall be the children of an specific profile. The inputs needed are: - The address of one of the parents of the profile. - The address of both profiles if the previous profile has 2 marriages (ideally select the profile with a single marriage) - The Token for geni. Obtain the token in this webpage: https://www.geni.com/platform/developer/api_explorer ''' from pyFS.pyfs_open_xlsx import getFSfamily from pyGeni import set_token my_file = "ENTER HERE THE LOCATION OF YOUR FILE" my_token = "INTRODUCE THE OBTAINED TOKEN" parent_profile = "INTRODUC THE HTTP ADDRESS OF THE PARENT PROFILE IF HAS A UNIQUE MARRIAGE" #We set the token set_token(my_token) family = getFSfamily(my_file) family.create_profiles_in_Geni(parent_profile)
def test_fs_reader(self): ''' Test reading an input file ''' input_file = os.path.join(self.filelocation, "fs-PotenteAsegurado.xlsx") fsclass = getFSfamily(input_file, naming_convention="spanish_surname", language="es") assert (fsclass.correct_execution) assert (fsclass.initial_column == 1) assert (fsclass.initial_row == 6) assert (fsclass.sheet_title == "Sheet0") #Maria Potente Asegurado assert ( fsclass.profiles[0].gen_data["birth"].get_date() == datetime.date( 1853, 9, 8)) assert (fsclass.profiles[0].gen_data["baptism"].get_date() == datetime.date(1853, 9, 13)) assert ( fsclass.profiles[0].gen_data["burial"].get_date() == datetime.date( 1853, 9, 30)) assert (fsclass.profiles[0].gen_data["baptism"].get_location() ["county"] == "Valladolid") assert (fsclass.profiles[0].gen_data["death"].get_location() ["place_name"] == "Calle De La Parrilla") assert (len(fsclass.profiles[0].gen_data["web_ref"]) == 3) assert ( fsclass.profiles[0].gen_data["residence"][0].get_year() == 1853) assert (fsclass.profiles[0].gen_data["residence"][0].get_accuracy() == "ABOUT") #Wenceslao Potente Asegurado assert ( fsclass.profiles[2].gen_data["birth"].get_date() == datetime.date( 1862, 9, 28)) assert (fsclass.profiles[2].gen_data["baptism"].get_date() == datetime.date(1862, 10, 2)) assert ( fsclass.profiles[2].gen_data["death"].get_date() == datetime.date( 1863, 6, 28)) assert ( fsclass.profiles[2].gen_data["burial"].get_date() == datetime.date( 1863, 6, 28)) assert (fsclass.profiles[2].gen_data["baptism"].get_location() ["place_name"] == "Calle Nuestra Señora De Los Remedios") assert (fsclass.profiles[2].gen_data["death"].get_location()["county"] == "Valladolid") assert (len(fsclass.profiles[2].gen_data["web_ref"]) == 2) assert ( fsclass.profiles[2].gen_data["residence"][0].get_year() == 1862) #Evarista Potente Asegurado assert ( fsclass.profiles[4].gen_data["birth"].get_date() == datetime.date( 1857, 10, 26)) assert (fsclass.profiles[4].gen_data["baptism"].get_date() == datetime.date(1857, 11, 1)) assert ( fsclass.profiles[4].gen_data["burial"].get_date() == datetime.date( 1858, 2, 25)) assert (fsclass.profiles[4].gen_data["baptism"].get_location() ["county"] == "Valladolid") assert (fsclass.profiles[4].gen_data["death"].get_location() ["place_name"] == "Calle De La Parrilla") assert (len(fsclass.profiles[4].gen_data["web_ref"]) == 2) assert ( fsclass.profiles[4].gen_data["residence"][0].get_year() == 1857)