def test_US_19(self): """ Function that tests user story 19 """ repository = Repository("../GedcomFiles/US_19.ged") expected = ['US_19: First cousins @I7@ and @I8@ married on line 76'] actual = US_19(repository.get_individual(), repository.get_family()) self.assertEqual(expected, actual)
def test_US_41(self): repository = Repository('../GedcomFiles/ssw555_input_file.ged') individual = repository.get_individual() self.assertEqual( individual['@I2@']._birth_date, datetime.datetime.strptime("1 JAN 1830", '%d %b %Y').date())
def test_US_42(self): """ Function that tests user story 42 """ repository = Repository('../GedcomFiles/ssw555_input_file.ged') individual = repository.get_individual() self.assertEqual( individual['@I1@']._birth_date, datetime.datetime.strptime("1 JAN 1850", '%d %b %Y').date())
def test_US_21(self): """ Function that tests user story 21 """ repository = Repository("../GedcomFiles/SSW_555_updatedwithUS_2_3.ged") expected = [ 'US_21: Sam /Robinson/ gender is supposed to be female but is not on line number 269' ] actual = US_21(repository.get_individual(), repository.get_family()) self.assertEqual(expected, actual)
def test_US_02(self): """ FUnction that tests user story 2 """ repository = Repository("../GedcomFiles/ssw555_input_file.ged") expected = [ 'US_02: Micheal /Mia/ birthday after marriage date on line number 604', 'US_02: Mike /Robinson/ birthday after marriage date on line number 604', 'US_02: Sam /Robinson/ birthday after marriage date on line number 633' ] actual = US_2(repository.get_individual(), repository.get_family()) self.assertEqual(expected, actual)
def test_US_43(self): """ Contains test cases for US_43""" repository = Repository("../GedcomFiles/SSW_555_updatedwithUS_2_3.ged") expected = [ 'Emmy /Robinson/ is divorced and alive on line number 151', 'Tia /Ale/ is divorced and alive on line number 324', 'Micheal /Mia/ is divorced and alive on line number 343', 'Mike /Robinson/ is divorced and alive on line number 333' ] actual = US_43(repository.get_individual(), repository.get_family()) self.assertEqual(expected, actual)
def test_US_28(self): repository = Repository('../GedcomFiles/US_28.ged') expected: List = [ '68 :- Joey /Robinson/ from FamID @F1@ with individual id @I1@ is on line ' 'number 14', '55 :- Mike /Robinson/ from FamID @F1@ with individual id @I5@ is on line ' 'number 58', '48 :- Ben /Mann/ from FamID @F1@ with individual id @I4@ is on line number ' '47' ] calculated: List = US_28(repository.get_individual(), repository.get_family()) self.assertEqual(calculated, expected)
def test_US_44(self): """ Contains test cases for US_44""" repository = Repository("../GedcomFiles/SSW_555_updatedwithUS_2_3.ged") expected = [ 'Priyanka /Robinson/ is alive and age is more than 100 years old on line ' 'number 34', 'Emmy /Robinson/ is alive and age is more than 100 years old on line number ' '151', 'Yatinkumar /Shiyani/ is alive and age is more than 100 years old on line ' 'number 292', 'Ginger /Ale/ is alive and age is more than 100 years old on line number 312', 'Tia /Ale/ is alive and age is more than 100 years old on line number 324' ] actual = US_44(repository.get_individual()) self.assertEqual(expected, actual)
def test_us_34(self): indi_repo: Repository = Repository("../GedcomFiles/US_34.ged") excepted: List = [ 'Rahul /Sharma/,70 and Pinal /Sharma/ ,22 are the couples who were married when the older spouse was more than as twice as old as the younger spouse on line number 52' ] calculated: List = us_34(indi_repo._individual, indi_repo._family) self.assertEqual(calculated, excepted)
def test_US_48(self): """ The function is to test US_48 function""" indi_repo: Repository = Repository( '../GedcomFiles/ssw555_input_file.ged') # The expected output expected = [ 'Wife @I2@ is older than husband @I1@.', 'Wife @I2@ is older than husband @I27@.', 'Wife @I2@ is older than husband @I26@.', 'Wife @I4@ is older than husband @I1@.', 'Wife @I46@ is older than husband @I47@.', 'Wife @I41@ is older than husband @I44@.' ] # generating a list of the output from the function result = [ value for value in US_48(indi_repo._individual, indi_repo._family) ] self.assertEqual(result, expected) # positive test result self.assertFalse(result == [ 'Birthdate "2022-01-01" for individual id @I1@ is illeagal', 'Birthdate "2020-12-06" for individual id @I13@ is illeagal' ]) # Negative test case
def test_US_25(self): """ The function helps to test US_25 function""" repository = Repository('../GedcomFiles/US_25.ged') expected: List = [ 'The family @F2@ has multiple individuals with same name Joey /Robinson/', 'There are multiple people born on 1980-09-13 date in family @F1@' ] self.assertEqual( sorted(US_25(repository._individual, repository._family)), expected) self.assertNotEqual( sorted(US_25(repository._individual, repository._family)), [ 'The family @F1@ has multiple individuals with same name Joey /Robinson/', 'There are multiple people born on 1822-01-01 date in family @F1@' ]) self.assertFalse( US_25(repository._individual, repository._family) == [ 'The family @F1@ has multiple individuals with same name Joey /Robinson/', 'There are multiple people born on 1822-01-01 date in family @F1@' ]) self.assertTrue( US_25(repository._individual, repository._family) == [ 'There are multiple people born on 1980-09-13 date in family @F1@', 'The family @F2@ has multiple individuals with same name Joey /Robinson/' ]) self.assertTrue( sorted(US_25(repository._individual, repository._family)) != [ 'The family @F1@ has multiple individuals with same name Joey /Robinson/', 'There are multiple people born on 1822-01-02 date in family @F1@' ])
def test_us_36(self): """ The function helps to test us_32 function""" indi_repo: Repository = Repository("../GedcomFiles/US_32_36.ged") expected: List = [] # 'Line number:41 Julie /Cohen/ died recently' self.assertEqual(us_36(indi_repo._individual), expected) self.assertNotEqual(us_36(indi_repo._individual), ['John /Cohen/ died recently'])
def test_us10(self): """ The function is to test US_10 function""" indi_repo: Repository = Repository( '../GedcomFiles/ssw555_input_file.ged') # The expected output expected = [ 'Family id Line number: 506\n' 'The husband @I1@ was younger than 14 at the time of marriage for @F1@', 'Family id Line number: 599\n' 'The husband @I31@ was younger than 14 at the time of marriage for @F13@', 'Family id Line number: 599\n' 'The wife @I32@ was younger than 14 at the time of marriage for @F13@', 'Family id Line number: 608\n' 'The husband @I1@ was younger than 14 at the time of marriage for @F14@', 'Family id Line number: 629\n' 'The husband @I1@ was younger than 14 at the time of marriage for @F20@', 'Family id Line number: 629\n' 'The wife @I25@ was younger than 14 at the time of marriage for @F20@' ] # generating a list of the output from the function result = [ value for value in US_10(indi_repo._individual, indi_repo._family) ] self.assertEqual(result, expected) # positive test result self.assertFalse(result == [ 'The family @F11@ has a death of wife @I7@ before the marriage date.' ]) # Negative # test case
def test_us09(self): """ The function is to test US_09 function""" indi_repo: Repository = Repository( '../GedcomFiles/ssw555_input_file.ged') # The expected output expected = { 'Family id Line number: 513\n' 'Birth of child @I28@ is before the death of the father @I27@', 'Family id Line number: 513\n' 'Birth of child @I28@ is before the death of the mother @I2@', 'Family id Line number: 522\n' 'Birth of child @I35@ is before the death of the father @I3@', 'Family id Line number: 522\n' 'Birth of child @I35@ is before the death of the mother @I4@', 'Family id Line number: 522\n' 'Birth of child @I31@ is before the death of the father @I3@', 'Family id Line number: 522\n' 'Birth of child @I31@ is before the death of the mother @I4@' } # generating a list of the output from the function result = { value for value in US_09(indi_repo._individual, indi_repo._family) } self.assertEqual(result, expected) # positive test result self.assertFalse(result == [ 'The family @F11@ has a death of wife @I7@ before the marriage date.' ]) # Negative # test case
def test_US_01(self): """ The function is to test US_01 function""" repository = Repository('../GedcomFiles/US_01.ged') # The expected output expected = [ 'Birthdate on Line: 21\nUS_01: Birthdate "2022-01-01" for individual id @I1@ is illeagal', 'Birthdate on Line: 156\nUS_01: Birthdate "2020-12-06" for individual id @I13@ is illeagal', 'On Line: 158\nUS_01: Date of death "2021-06-03" for individual id @I13@ is illeagal', 'Birthdate on Line: 167\nUS_01: Birthdate "2020-12-06" for individual id @I14@ is illeagal', 'Birthdate on Line: 177\nUS_01: Birthdate "2059-05-04" for individual id @I15@ is illeagal', 'On Line: 218\nUS_01: Marriage date "2025-08-04" for family id @F4@ is illeagal', 'On Line: 240\nUS_01: Marriage date "2090-04-05" for family id @F7@ is illeagal' ] # generating a list of the output from the function result = [ value for value in US_01(repository._individual, repository._family) ] self.assertEqual(result, expected) # positive test result self.assertFalse(result == [ 'Birthdate "2022-01-01" for individual id @I1@ is illeagal', 'Birthdate "2020-12-06" for individual id @I13@ is illeagal' ]) # Negative test case
def test_US_51(self): """ The function helps to test US_51 function""" indi_repo = Repository("../GedcomFiles/US_51.ged") expected = [ 'The family id @F4@ have their marriage anniversary in the next 2 months. Line number: 419' ] self.assertEqual(US_51(indi_repo._family), expected)
def test_US_08(self): """ The function is to test US_08 function""" indi_repo: Repository = Repository( '../GedcomFiles/ssw555_input_file.ged') # The expected output expected = [ 'Family id Line number: 506\n' 'The Father @I1@ is younger than his child @I4@ which is illeagal.', 'Family id Line number: 599\n' 'The Father @I31@ is younger than his child @I33@ which is illeagal.', 'Family id Line number: 618\n' 'The Father @I36@ is younger than his child @I1@ which is illeagal.', 'Family id Line number: 647\n' 'The Mother @I48@ is younger than her child @I42@ which is illeagal.', 'Family id Line number: 652\n' 'The Father @I47@ is younger than his child @I43@ which is illeagal.', 'Family id Line number: 657\n' 'The Father @I44@ is younger than his child @I45@ which is illeagal.' ] # generating a list of the output from the function result = [ value for value in US_08(indi_repo._individual, indi_repo._family) ] self.assertEqual(result, expected) # positive test result self.assertFalse(result == [ 'The family @F11@ has a death of wife @I7@ before the marriage date.' ]) # Negative # test case
def test_US_38(self): """ The function helps to test upcoming birthdates""" indi_repo: Repository = Repository("../GedcomFiles/US_38.ged") expected: List = [ 'Line number 39, Emmy /Robinson/ has upcoming birthday', 'Line number 48, Jil /Robinson/ has upcoming birthday', 'Line number 57, Sam /Robinson/ has upcoming birthday' ] self.assertEqual(US_38(indi_repo._individual), expected) self.assertNotEqual(US_38(indi_repo._individual), ['William /Robinson/ has upcoming birthday']) self.assertFalse( US_38(indi_repo._individual) == ['Jim /Robinson/ has recent birthday']) self.assertTrue( US_38(indi_repo._individual) == [ 'Line number 39, Emmy /Robinson/ has upcoming birthday', 'Line number 48, Jil /Robinson/ has upcoming birthday', 'Line number 57, Sam /Robinson/ has upcoming birthday' ]) self.assertTrue( US_38(indi_repo._individual) != ['Smith /Robinson/ has upcoming birthday'])
def test_us_45(self): indi_repo: Repository = Repository("../GedcomFiles/US_45.ged") excepted: List = [ 'Rahul /Sharma/ on line number 21', 'Riya /Sharma/ on line number 41' ] calculated = [i for i in us_45(indi_repo)] self.assertEqual(calculated, excepted)
def test_US_20(self): """ The function helps to test US_20 function""" repository = Repository("../GedcomFiles/US_20.ged") expected = [ "Individuals @I1@ and @I9@ are uncle/aunt and niece/nephew married on line number 324" ] self.assertEqual(US_20(repository._family, repository._individual), expected)
def test_us_37(self): indi_repo: Repository = Repository("../GedcomFiles/US_37.ged") excepted: List = [ 'Living Spouse: Dhruv /Shah/ and descendant : Saddi /Shah/ on line number 115', 'Living Spouse: Dhiru /Shah/ and descendant : Praj /Shah/ on line number 120', ' Living spouse: Riya /Patel/ and Descendant : Dhiru /Shah/ on line number 128 ', ] calculated: List = us_37(indi_repo._individual, indi_repo._family) self.assertEqual(calculated, excepted)
def test_US_15(self): """ Contains test cases for US_15""" indi_repo: Repository = Repository("../GedcomFiles/US_15.ged") expected = [ "US:15 Family id:@F1@ has 15 or more children on line number 180" ] self.assertEqual(US_15(indi_repo._family), expected)
def test_US_06(self): """ Contains test cases for US_06""" repository = Repository('../GedcomFiles/US_06.ged') expected = [ "US_06: Katir /Bala/ Death 1822-01-03 occured prior to the divorce date 1852-07-14" ] self.assertEqual((US_06(repository._individual, repository._family)), expected)
def test_US_54(self): """ Contains test cases for US_54""" indi_repo: Repository = Repository("../GedcomFiles/US_53.ged") exp = [ "US_54: Katir /Bala/ with @I3@ is younger than child Pia /Ale/ in line number 180 " ] self.assertEqual(US_54(indi_repo._individual, indi_repo._family), exp)
def test_US_14(self): """ Contains test cases for US_14""" indi_repo: Repository = Repository("../GedcomFiles/US_14.ged") exp = [ "US14: @F1@ has more than 5 children born on same date 2005-01-01 in line number 180" ] self.assertEqual(US_14(indi_repo._individual, indi_repo._family), exp)
def test_US_53(self): """ Contains test cases for US_53""" indi_repo: Repository = Repository("../GedcomFiles/US_53.ged") exp = [ "US_53: Husband Katir /Bala/ with @I2@ has the same name as wife Katir /Bala/ with @I3@ in line number 180 " ] self.assertEqual(US_53(indi_repo._individual, indi_repo._family), exp)
def test_us_46(self): indi_repo: Repository = Repository("../GedcomFiles/US_46.ged") excepted: List = [ ' Tina /Sharma/ is married and dead on line number 30', ' Kiran /Sharma/ is married and ' 'dead on line number 51' ] calculated: List = us_46(indi_repo._individual) self.assertEqual(calculated, excepted)
def test_us_30(self): indi_repo: Repository = Repository("../GedcomFiles/US_30.ged") excepted: List = [ ' Seema /Sharma/ is married and alive on line number 32', ' Poonam /Sharma/ is married and alive on line number 41', ' Snehal /Sharma/ is married and alive on line number 51', ' Renu /Sharma/ is married and alive on line number 72' ] calculated: List = us_30(indi_repo._individual) self.assertEqual(calculated, excepted)
def test_US_12(self): """ Contains test cases for US_12""" indi_repo: Repository = Repository("../GedcomFiles/US_12.ged") exp = [ "US_12: Yatinkumar /Shiyani/ with @I27@ is 80 years or older than Mia /Shiyani/ id:{'@I28@'} in line number 398 ", "US_12: Priyanka /Robinson/ with @I2@ is 60 years or older than Mia /Shiyani/ id:{'@I28@'} in line number 398 " ] self.assertEqual(US_12(indi_repo._individual, indi_repo._family), exp)
def test_US_35(self): """The function helps to test US_35 function""" repository = Repository('../GedcomFiles/US_35.ged') expected: List = [] # 'Jil /Robinson/ has recent birthday' self.assertEqual(US_35(repository._individual), expected) self.assertNotEqual(US_35(repository._individual), ['William /Robinson/ has recent birthday']) self.assertTrue( US_35(repository._individual) != ['Smith /Robinson/ has recent birthday'])