def test_ppt(self): """ Test for US01, US02, US03, US04, US05, US06, US10 """ directory_path = "/Users/saranshahlawat/Desktop/Stevens/Semesters/Summer 2019/SSW-555/project/GEDCOM/project3/data/PPTtest2.ged" error_chk = [{ 'us02': { 0: [False, False, False, True, False, True, True] }, 'us04': { 0: [False, True, False] }, 'us05': { 0: [False, True, False] }, 'us06': { 0: [True, False, False] } }, { 0: [True, True, True, False], 1: [False, False, True, False] }, { 0: True, 1: False }] self.assertEqual(print_pretty_table(directory_path), error_chk)
def test_user_stories(self): dir_path = os.path.abspath( os.path.join(os.path.dirname(__file__), '..')) directory_path_us29 = f'{dir_path}/data/us29.ged' directory_path_us30 = f'{dir_path}/data/us30.ged' individuals_us29, families_us29 = gedcom_file_parser( directory_path_us29) individuals_us30, families_us30 = gedcom_file_parser( directory_path_us30) print_pretty_table(directory_path_us29) print_pretty_table(directory_path_us30) # Expected Result for US29 us29_pt = PrettyTable(field_names=["ID", "Name"]) us29_pt.add_row(['@I7@', 'Peter /Evans/']) us29_pt.add_row(['@I10@', 'Darren /Johnson/']) us29_str = "US29: List: The following individuals are deceased in the family\n" + str( us29_pt) self.assertEqual(list_deceased(individuals_us29), us29_str) #US30 Expected Results us30_pt = PrettyTable(field_names=[ "Family ID", "Husband ID", "Husband Name", "Wife ID", "Wife Name" ]) us30_pt.add_row( ['@F1@', '@I5@', 'Angelo /Rose/', '@I1@', 'Tristin /Evans/']) us30_pt.add_row( ['@F2@', '@I2@', 'Phil /Evans/', '@I3@', 'Sheila /Lynn/']) us30_pt.add_row( ['@F4@', '@I11@', 'David /Lynn/', '@I12@', 'Victoria /Taylor/']) us30_str = "US30: List: The following lists living married couples by family\n" + str( us30_pt) self.assertEqual(list_living_married(individuals_us30, families_us30), us30_str)
def test_user_stories(self): directory_path = '/Users/saranshahlawat/Desktop/Stevens/Semesters/Summer 2019/SSW-555/project/GEDCOM/project3/data/US07_US08_test_file.ged' individuals, families = gedcom_file_parser(directory_path) print_pretty_table(directory_path) #US07 Test capturedOutput = io.StringIO() sys.stdout = capturedOutput check_150_years_age(individuals) sys.stdout = sys.__stdout__ self.assertEqual( capturedOutput.getvalue(), 'ERROR: INDIVIDUAL: US07: @I3@: More than 150 years old - Birth date 19 May 0268\nERROR: INDIVIDUAL: US07: @I9@: More than 150 years old at death - Birth date 17 Nov 0301: Death date 15 Nov 0560\n' ) #US08 Test capturedOutput2 = io.StringIO() sys.stdout = capturedOutput2 check_birth_before_marriage_of_parents(families, individuals) sys.stdout = sys.__stdout__ self.assertEqual( capturedOutput2.getvalue(), 'ANOMOLY: FAMILY: US08: @F3@: Child @I7@ born 05 Sep 0287 before marriage on 16 Jun 0280\nANOMOLY: FAMILY: US08: @F3@: Child @I7@ born 05 Sep 0287 after divorce on 18 Nov 0285\n' )
import unittest import os from gedcom_file_parser import print_pretty_table import util_date import US07_US08_Test_Suite import unit_test_us1_us2_us3_us4_us5_us6_us10 if __name__ == '__main__': dir_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # dir_path = os.getcwd("../"); print_pretty_table(f"{dir_path}/data/project01.ged") suit1 = unittest.TestLoader().loadTestsFromModule(util_date) suit2 = unittest.TestLoader().loadTestsFromModule( unit_test_us1_us2_us3_us4_us5_us6_us10) suit3 = unittest.TestLoader().loadTestsFromModule(US07_US08_Test_Suite) unittest.TextTestRunner(verbosity=2).run(suit1) unittest.TextTestRunner(verbosity=2).run(suit2) unittest.TextTestRunner(verbosity=2).run(suit3)
import os from gedcom_file_parser import print_pretty_table if __name__ == '__main__': dir_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) print_pretty_table(f"{dir_path}/data/sprint3userstorytest.ged")
def test_ppt(self): """ Test for Get_Spouse_Block and Get_Child_Block """ # error_chk holds expected results returned from function print_pretty_table as three dictionaries of booleans e1, e2, and e3. # e1 is a dictionary of dictionaries of booleans returned from function get_spouse_block # e2 is a dictionary of dictionaries of booleans returned from function get_child_block # e3 is a dictionary of dictionaries of booleans returned from function get_recent_block # self.assertEqual will used to test the expected results stored in error_chk against the observed results returned from the function. dir_path = os.path.abspath( os.path.join(os.path.dirname(__file__), '..')) directory_path = f"{dir_path}/data/sprint2userstorytest.ged" # Expected Result for US28 us28a_pt = PrettyTable(field_names=["ID", "Name", "Date of Birth"]) us28a_pt.add_row(['@I3@', 'Emma /Rose/', '27 May 2018']) us28a_pt.add_row(['@I7@', 'Isabel /Rose/', '27 May 2018']) us28a_pt.add_row(['@I8@', 'Angela /Rose/', '27 May 2018']) us28a_pt.add_row(['@I9@', 'Trish /Rose/', '27 May 2018']) us28a_pt.add_row(['@I10@', 'Ethan /Rose/', '27 May 2018']) us28a_pt.add_row(['@I11@', 'Ian /Rose/', '27 May 2018']) us28a_pt.add_row(['@I12@', 'Michael /Rose/', '27 May 2018']) us28a_pt.add_row(['@I13@', 'Richelle /Rose/', '27 May 2018']) us28a_pt.add_row(['@I14@', 'Matthew /Rose/', '27 May 2018']) us28a_pt.add_row(['@I15@', 'Luke /Rose/', '27 May 2018']) us28a_pt.add_row(['@I16@', 'Cynthia /Rose/', '27 May 2018']) us28a_pt.add_row(['@I17@', 'Frederick /Rose/', '27 May 2018']) us28a_pt.add_row(['@I18@', 'Tina /Rose/', '27 May 2018']) us28a_pt.add_row(['@I19@', 'Tanya /Rose/', '27 May 2018']) us28a_pt.add_row(['@I20@', 'Emmy /Rose/', '27 May 2018']) us28a_pt.add_row(['@I21@', 'Thomas /Rose/', '27 May 2018']) us28a_pt.add_row(['@I22@', 'Richelle /Rose/', '02 May 2019']) us28a_str = str(us28a_pt) us28b_pt = PrettyTable(field_names=["ID", "Name", "Date of Birth"]) us28b_pt.add_row(['@I1@', 'Tristin /Evans/', '12 Apr 1987']) us28b_pt.add_row(['@I5@', 'Aeryn /Evans/', '30 Apr 1987']) us28b_str = str(us28b_pt) # Expected Result for US32 us32_pt = PrettyTable(field_names=["ID", "Name"]) us32_pt.add_row(['@I3@', 'Emma /Rose/']) us32_pt.add_row(['@I7@', 'Isabel /Rose/']) us32_pt.add_row(['@I8@', 'Angela /Rose/']) us32_pt.add_row(['@I9@', 'Trish /Rose/']) us32_pt.add_row(['@I10@', 'Ethan /Rose/']) us32_pt.add_row(['@I11@', 'Ian /Rose/']) us32_pt.add_row(['@I12@', 'Michael /Rose/']) us32_pt.add_row(['@I13@', 'Richelle /Rose/']) us32_pt.add_row(['@I14@', 'Matthew /Rose/']) us32_pt.add_row(['@I15@', 'Luke /Rose/']) us32_pt.add_row(['@I16@', 'Cynthia /Rose/']) us32_pt.add_row(['@I17@', 'Frederick /Rose/']) us32_pt.add_row(['@I18@', 'Tina /Rose/']) us32_pt.add_row(['@I19@', 'Tanya /Rose/']) us32_pt.add_row(['@I20@', 'Emmy /Rose/']) us32_pt.add_row(['@I21@', 'Thomas /Rose/']) us32_str = str(us32_pt) # Expected Result for US33 us33_pt = PrettyTable(field_names=["ID", "Name"]) us33_pt.add_row(['@I3@', 'Emma /Rose/']) us33_pt.add_row(['@I7@', 'Isabel /Rose/']) us33_pt.add_row(['@I8@', 'Angela /Rose/']) us33_pt.add_row(['@I9@', 'Trish /Rose/']) us33_pt.add_row(['@I10@', 'Ethan /Rose/']) us33_pt.add_row(['@I11@', 'Ian /Rose/']) us33_pt.add_row(['@I12@', 'Michael /Rose/']) us33_pt.add_row(['@I13@', 'Richelle /Rose/']) us33_pt.add_row(['@I14@', 'Matthew /Rose/']) us33_pt.add_row(['@I15@', 'Luke /Rose/']) us33_pt.add_row(['@I16@', 'Cynthia /Rose/']) us33_pt.add_row(['@I17@', 'Frederick /Rose/']) us33_pt.add_row(['@I18@', 'Tina /Rose/']) us33_pt.add_row(['@I19@', 'Tanya /Rose/']) us33_pt.add_row(['@I20@', 'Emmy /Rose/']) us33_pt.add_row(['@I21@', 'Thomas /Rose/']) us33_str = str(us33_pt) error_chk = [ # get_spouse_block results { 'us01': True, 'us02': { 0: True, 1: True, 2: False }, 'us03': True, 'us04': { 0: False, 1: True, 2: False }, 'us05': { 0: False, 1: True, 2: False }, 'us06': { 0: False, 1: True, 2: False }, 'us10': True }, # get_child_block results { 'us13': { 0: False, 1: True, }, 'us14': {}, 'us15': { 0: True, 1: False }, 'us17': { 0: True, 1: False }, 'us18': { 2: True }, 'us28': { 0: us28a_str, 1: us28b_str }, 'us32': { 0: us32_str, 1: "" }, 'us33': { 0: us33_str, 1: False } } # get_recent_block results ] self.assertEqual(print_pretty_table(directory_path), error_chk)