def test_us35(self): """Function that tests us35_recent_births()""" classify = Classification('us35_us42.ged') recent_births = classify.us35_recent_births() expect = { '17 SEP 2019': ['Rob /Kardashian/'], '18 SEP 2019': ['Kourtney /Kardashian/'] } self.assertEqual(recent_births, expect)
import unittest from project_03 import Person, Family, Classification classify = Classification('us04_us27.get') class StoryTest(unittest.TestCase): def test_us04(self): """Function that tests us04_marriage_before_divorse()""" marriage_divorse = classify.us04_marriage_before_divorse() expect = 'ERROR: FAMILY: US04: (line# goes here) @F2@: Divorced 23 MAR 1990 before married on 12 APR 1991' self.assertEqual(marriage_divorse, expect) def test_us27(self): """Function that tests us27_individual_ages()""" individual_ages = list(classify.us27_individual_ages()) expect = [('@I1@', 63), ('@I2@', 59), ('@I3@', 69), ('@I4@', 32), ('@I5@', 40), ('@I10@', 39), ('@I12@', 36)] self.assertEqual (individual_ages, expect) if __name__ == "__main__": unittest.main(exit=False, verbosity=2)
def test_us31(self): """Function that tests us31_living_singles()""" classify = Classification('us31_us32.ged') living_singles_list = classify.us31_living_singles() expect = [('@28@', 'Smith /Joseph'), ('@29@', 'Sasquatch /Kyle'), ('@30@', 'Birch /Cynthia')] self.assertEqual (living_singles_list, expect)
def test_us32(self): """Function that tests us31_multiple_births()""" classify = Classification('us31_us32.ged') multiple_births = classify.us32_multiple_births() expect = {'6 NOV 1950': ['Smith /Joseph', 'Sasquatch /Kyle'], '6 NOV 1979': ['Lamar /Odom/', 'Birch /Cynthia']} self.assertEqual (multiple_births, expect)
import unittest from datetime import datetime from datetime import date from project_03 import Person, Family, Classification classify = Classification('us01_us03.ged') class StoriesTest(unittest.TestCase): def test_us01(self): 'US01 test Dates (birth, marriage, divorce, death) should not be after the current date' day = '24 Sep 2019' d1 = datetime.strptime(day, '%d %b %Y') us01 = classify.us01_before_current_dates(d1) expect = [ 'INDI BIRTH ERROR', 'INDI DEAT ERROR', 'FAM MARR ERROR', 'FAM DIVO ERROR' ] self.assertEqual(us01, expect) def test_us03(self): 'US03 test Birth should occur before death of an individual' us03 = classify.us03_birth_before_death() expect = 'ERROR: INDIVIDUAL: US03: LINE NUMBER: @I2@ : Died 30 SEP 1943 before born 22 FEB 1944' self.assertEqual(us03, expect)
import unittest from datetime import datetime from datetime import date from project_03 import Person, Family, Classification classify = Classification( '/Users/MaramAlrshoud/Documents/Universites/Stevens/Fall 2019/SSW 555/Week5/us01_us03.ged' ) class StoriesTest(unittest.TestCase): def test_us01(self): 'US01 test Dates (birth, marriage, divorce, death) should not be after the current date' day = '24 Sep 2019' d1 = datetime.strptime(day, '%d %b %Y') us01 = classify.us01_before_current_dates(d1) expect = [ 'INDI BIRTH ERROR', 'INDI DEAT ERROR', 'FAM MARR ERROR', 'FAM DIVO ERROR' ] self.assertEqual(us01, expect) def test_us03(self): 'US03 test Birth should occur before death of an individual' us03 = list(classify.us03_birth_before_death()) expect = [ 'ERROR: INDIVIDUAL: US03: @I2@: Died on 30 SEP 1943: line (34): before born on 22 FEB 1944' ]
import unittest from project_03 import Person, Family, Classification classify = Classification('/Users/nadik/Desktop/gedcom-analyzer/us04_us27.get') class StoryTest(unittest.TestCase): def test_us04(self): """Function that tests us04_marriage_before_divorse()""" marriage_divorse = classify.us04_marriage_before_divorse() expect = 'ERROR: FAMILY: US04: (line# goes here) @F2@: Divorced 23 MAR 1990 before married on 12 APR 1991' self.assertEqual(marriage_divorse, expect) def test_us27(self): """Function that tests us27_individual_ages()""" individual_ages = list(classify.us27_individual_ages()) expect = [('@I1@', 63), ('@I2@', 59), ('@I3@', 69), ('@I4@', 32), ('@I5@', 40), ('@I10@', 39), ('@I12@', 36)] self.assertEqual(individual_ages, expect) if __name__ == "__main__": unittest.main(exit=False, verbosity=2)
import unittest from datetime import datetime from project_03 import Person, Family, Classification from project_03 import valid_date classify = Classification( '/Users/MaramAlrshoud/Documents/Universites/Stevens/Fall 2019/SSW 555/Week6/gedcom-analyzer-Sprint2/test_results.ged' ) class StoriesTest(unittest.TestCase): def test_us29_list_deceased(self): 'US29 test deceased individual' us29 = classify.us29_list_deceased() expect = [('Robert /Kardashian/', '30 SEP 1943'), ('Johann /Bach', '31 MAR 1887')] self.assertEqual(us29, expect) def test_us30_list_living_married(self): 'US30 test living_married' us30 = classify.us30_list_living_married() expect = [('@I1@', 'Kris /Jenner/'), ('@I6@', 'Kim /Kardashian/'), ('@I16@', 'Kaney /West/'), ('@I8@', 'Kylie /Jenner/'), ('@I22@', 'Travis /Scott/')] self.assertEqual(us30, expect) if __name__ == "__main__":
import unittest from datetime import datetime from project_03 import Person, Family, Classification from project_03 import valid_date classify = Classification('./test_results.ged') nadia_sprint3_test = Classification('./nadia_sprint3_test.ged') katya_sprint4_test = Classification('./katya_sprint4_test.ged') maram_sprint4_test = Classification('./maram_sprint4_test.ged') rucha_sprint4_test = Classification('./print_output.ged') nadia_sprint4_test = Classification('./nadia_sprint4_test.ged') class StoryTest(unittest.TestCase): def test_us01(self): 'US01 test Dates (birth, marriage, divorce, death) should not be after the current date' day = '24 Sep 2019' d1 = datetime.strptime(day, '%d %b %Y') us01 = classify.us01_before_current_dates(d1) expect = [ 'INDI BIRTH ERROR', 'INDI DEAT ERROR', 'FAM MARR ERROR', 'FAM DIVO ERROR' ] self.assertEqual(us01, expect) def test_us02(self): 'Function that tests us02_birth_before_marriage(): US02 Birth should occur before marriage of an individual' us02 = list(classify.us02_birth_before_marriage()) expect = [