def test_us14_multiple_births_fewer_than_6(self): """ Check if US14 works properly """ sprint1 = GedcomTree(r'./GEDCOM_files/GEDCOM_us14us15.ged', pt=False) families = sprint1.us14_multiple_births_fewer_than_6(debug=True) self.assertIn('@F6@', families) self.assertEqual(len(families), 1)
def test_us15_fewer_than_15_siblings(self): """ Check if US15 works properly """ sprint1 = GedcomTree(r'./GEDCOM_files/GEDCOM_us14us15.ged', pt=False) families = sprint1.us15_fewer_than_15_siblings(debug=True) self.assertIn('@F6@', families) self.assertEqual(len(families), 1)
def test_us06_divorce_before_death(self): """ Check if User Story 06 Works Properly """ sprint2 = GedcomTree(r'./GEDCOM_files/Sprint2_test_GEDCOM.ged') debug_list = sprint2.us06_divorce_before_death(debug=True) self.assertEqual(len(debug_list), 2) self.assertIn("@I25@", debug_list) self.assertIn("@I26@", debug_list)
def test_us33_list_orphans(self): """ Check if US33 works properly """ sprint1 = GedcomTree(r'./GEDCOM_files/Sprint1_test_GEDCOM.ged', pt=False) orphans = sprint1.us33_list_orphans(debug=True) self.assertTrue(len(orphans) == 1) self.assertFalse(len(orphans) == 0)
def test_us23_unique_name_and_birth_date(self): """ Check if User Story 23 works properly """ sprint4 = GedcomTree(r'./GEDCOM_files/Sprint4_test_GEDCOM.ged', pt=False, write=False) bug_number = sprint4.us23_unique_name_and_birth_date(debug=True) self.assertEqual(bug_number, 1)
def test_us38_upcoming_birthdays(self): """ Check if US38 works properly """ sprint1 = GedcomTree(r'./GEDCOM_files/Sprint1_test_GEDCOM.ged', pt=False) debug_list = sprint1.us38_upcoming_birthdays(pt=False, debug=True) for time_delta in debug_list: self.assertTrue(time_delta.days < 30)
def test_us08_birth_before_marriage_ofParents(self): """ Check if US08 works properly """ sprint2 = GedcomTree(r'./GEDCOM_files/Sprint2_test_GEDCOM.ged') debug_list = sprint2.us08_birth_before_marriage_of_parents(debug=True) self.assertIn('@I1@', debug_list) self.assertIn('@I4@', debug_list) self.assertIn('@I2@', debug_list) self.assertEqual(len(debug_list), 3)
def test_us07_less_than_150_years_old(self): """ Check if User Story 07 works properly """ sprint4 = GedcomTree(r'./GEDCOM_files/Sprint4_test_GEDCOM.ged', pt=False, write=False) debug_list = sprint4.us07_less_than_150_years_old(debug=True) self.assertEqual(len(debug_list), 1) self.assertIn("@I7@", debug_list)
def test_us09_birth_before_death_ofParents(self): """ Check if US09 works properly """ sprint2 = GedcomTree(r'./GEDCOM_files/Sprint2_test_GEDCOM.ged') debug_list = sprint2.us09_birth_before_death_of_parents(debug=True) self.assertIn('@I16@', debug_list) self.assertIn('@I23@', debug_list) self.assertIn('@I25@', debug_list) self.assertEqual(len(debug_list), 3)
def test_us22_unique_ids(self): """ Check if US22 works properly """ sprint1 = GedcomTree(r'./GEDCOM_files/Sprint1_test_GEDCOM.ged', pt=False) unique_ids, duplicate_ids = sprint1.us22_unique_ids(debug=True) self.assertTrue(len(unique_ids) == 64) self.assertTrue(len(duplicate_ids) == 2) self.assertFalse(len(duplicate_ids) == 0)
def test_us36_list_recent_deaths(self): """ Check if US36 works properly """ sprint2 = GedcomTree(r'./GEDCOM_files/Sprint2_test_GEDCOM.ged') recent_deaths = sprint2.us36_list_recent_deaths(debug=True) # self.assertIn('@I31@', recent_deaths[0]) # self.assertEqual(len(recent_deaths), 1) for time_delta in recent_deaths: self.assertTrue(time_delta.days < 30)
def test_us05_marriage_before_death(self): """ Check if User Story 05 works properly """ sprint4 = GedcomTree(r'./GEDCOM_files/Sprint4_test_GEDCOM.ged', pt=False, write=False) debug_list = sprint4.us05_marriage_before_death(debug=True) self.assertEqual(len(debug_list), 2) self.assertIn("@I7@", debug_list) self.assertIn("@I8@", debug_list)
def test_us04_marriage_after_divorce(self): """ Check if User Story 04 works properly """ sprint4 = GedcomTree(r'./GEDCOM_files/Sprint4_test_GEDCOM.ged', pt=False, write=False) debug_list = sprint4.us04_marriage_after_divorce(debug=True) self.assertEqual(len(debug_list), 2) self.assertIn("@I31@", debug_list) self.assertIn("@I30@", debug_list)
def test_us19_first_cousins_should_not_marry(self): """ Check if User Story 19 works properly """ sprint4 = GedcomTree(r'./GEDCOM_files/Sprint4_test_GEDCOM.ged', pt=False, write=False) debug_list = sprint4.us19_first_cousins_should_not_marry(debug=True) self.assertEqual(len(debug_list), 3) self.assertIn("@F4@", debug_list) self.assertIn("@F8@", debug_list)
def test_us11_no_bigamy(self): """ Check if User Story 11 works properly """ sprint4 = GedcomTree(r'./GEDCOM_files/Sprint4_test_GEDCOM.ged', pt=False, write=False) debug_list = sprint4.us11_no_bigamy(debug=True) self.assertEqual(len(debug_list), 4) self.assertIn("@I6@", debug_list) self.assertIn("@I13@", debug_list) self.assertIn("@I19@", debug_list)
def test_us42_reject_illegitimate_dates(self): """ Check if User Story 42 works properly """ sprint4 = GedcomTree(r'./GEDCOM_files/Sprint4_test_GEDCOM.ged', pt=False, write=False) debug_list = sprint4.us42_reject_illegitimate_dates(debug=True) self.assertEqual(len(debug_list), 6) self.assertIn("@I31@", debug_list) self.assertIn("@I32@", debug_list) self.assertIn("@F4@", debug_list) self.assertIn("@F8@", debug_list) self.assertIn("@F16@", debug_list)
def test_us40_include_input_line_numbers(self): """ Check if User Story 40 works properly """ sprint4 = GedcomTree(r'./GEDCOM_files/Sprint4_test_GEDCOM.ged', pt=False, write=False) debug_list = sprint4.us40_include_input_line_numbers(debug=True) with open(r'./GEDCOM_files/Sprint4_test_GEDCOM.ged') as fp: for index, line in enumerate(fp): pass total_lines = index + 1 for line_numbers in debug_list: self.assertTrue(0 < line_numbers) self.assertTrue(line_numbers < total_lines) self.assertFalse(line_numbers <= 0) self.assertFalse(line_numbers > total_lines)
def test_us21_correct_gender(self): """ Check if all the wrong gender elements are included """ sprint2 = GedcomTree(r'./GEDCOM_files/U17_21_test.ged') wrong_gender_list = sprint2.us21_correct_gender_for_role(debug=True) self.assertEqual(len(wrong_gender_list), 4)
def test_us17_no_child_marry(self): """ Check if all the wrong marriage elements are included """ sprint2 = GedcomTree(r'./GEDCOM_files/U17_21_test.ged') wrong_marry_list = sprint2.us17_no_marriage_to_children(debug=True) self.assertEqual(len(wrong_marry_list), 3)
def test_us16_male_lastname(self): """ Check if US16 works properly """ sprint1 = GedcomTree(r'./GEDCOM_files/Sprint1_test_GEDCOM.ged', pt=False) error = sprint1.us16_male_lastname(debug=True) self.assertTrue(len(error) == 1)
def test_us31_list_living_single(self): """ Check if US31 works properly """ sprint1 = GedcomTree(r'./GEDCOM_files/GEDCOM_us14us15.ged', pt=False) self.assertTrue( len(sprint1.us31_list_living_single(pt=False, debug=True)) == 25)
def test_us30_list_living_married(self): """ Check if US30 works properly """ sprint1 = GedcomTree(r'./GEDCOM_files/GEDCOM_us14us15.ged', pt=False) self.assertTrue( len(sprint1.us30_list_living_married(pt=False, debug=True)) == 18)