Example #1
0
 def test_birth_before_death(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(us03_birth_before_death(test), [('ERROR', 'INDIVIDUAL', 'US03', 170, '@I_H_US03_1@', 'Death 1600-11-10 occurs before birth 1630-02-11.')])
 def test_us17_no_marriages_to_children(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(us17_no_marriages_to_children(test),[('ANOMALY', 'FAMILY', 'US17', 424, '@F_W_US17_2@', 'Father @I_W_US17_1@ was married to child @I_W_US17_3@')])
 def test_not_olderthan150(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(us07_not_olderthan150(test), [('ERROR', 'INDIVIDUAL', 'US07', 133, '@I_W_US07_1@', 'More than 150 years old - Birth date: 1860-01-01.'),
                                             ('ERROR', 'INDIVIDUAL', 'US07', 138, '@I_W_US07_2@', 'More than 150 years old at death - Birth date: 1850-01-01, Death date: 2005-01-02.')])
 def test_us15(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(us15_more_than_15siblings(test),
                      [('ANOMALY', 'FAMILY', 'US15', 697, '@F_L_US15_1@',
                        'More than 15 siblings in a family, Number : 16')])
Example #5
0
 def test_current_date_check(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(us01_current_date_check(test), [('ERROR', 'INDIVIDUAL', 'US01', 119, '@I_W_US01_1@', 'Birthday 2021-01-01 occurs in the future.'),
                                                 ('ERROR', 'INDIVIDUAL', 'US01', 127, '@I_W_US01_2@', 'DEATH 2081-12-30 occurs in the future.'), 
                                                 ('ERROR', 'FAMILY', 'US01', 201, '@F_W_US01_1@', 'Marriage date 2040-02-21 occurs in the future.'), 
                                                 ('ERROR', 'FAMILY', 'US01', 203, '@F_W_US01_1@', 'Divorce date 2070-01-01 occurs in the future.')])
 def test_divorce_before_marriage(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(us06_divorce_before_death(test), [
         ('ERROR', 'FAMILY', 'US06', 479, '@F_H_US06_1@',
          'Divorce date 1712-01-01 occurs after husband death 1700-11-10.'),
         ('ERROR', 'FAMILY', 'US06', 479, '@F_H_US06_1@',
          'Divorce date 1712-01-01 occurs after wife death 1711-11-10.')
     ])
Example #7
0
 def test_birth_before_marriage(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(us02_birth_before_marriage(test), [
         ('ERROR', 'FAMILY', 'US02', 209, '@F_H_US02_1@',
          'Marriage date 1531-07-21 occurs before husband birth 1600-01-10.'
          ),
         ('ERROR', 'FAMILY', 'US02', 209, '@F_H_US02_1@',
          'Marriage date 1531-07-21 occurs before wife birth 1600-02-11.')
     ])
 def test_us04(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(us04_marriage_before_divorce(test), [
         ('ERROR', 'FAMILY', 'US04', 235, '@F_Z_US04_1@',
          'Family @F_Z_US04_1@ has no marriage date. '),
         ('ERROR', 'FAMILY', 'US04', (238, 242, 244), '@F_Z_US04_2@',
          'Family @F_Z_US04_2@ marriage date is after than divorce date. '),
         ('ERROR', 'FAMILY', 'US04', (278, 282, 284), '@F_Z_US05_2@',
          'Family @F_Z_US05_2@ marriage date is after than divorce date. ')
     ])
 def test_us10(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(
         us10_marriage_after_14(test),
         [('ANOMALY', 'FAMILY', 'US10', 235, '@F_Z_US04_1@',
           'Family <@F_Z_US04_1@> do not have marriage date.'),
          ('ERROR', 'INDIVIDUAL', 'US10', (249, 277), '@I_Z_US05_1@',
           'Husband:<@I_Z_US05_1@> marriage before he is 14 years old.'),
          ('ERROR', 'INDIVIDUAL', 'US10', (564, 570), '@I_Z_US10_2@',
           'Wife:<@I_Z_US10_2@> marriage before she is 14 years old.')])
Example #10
0
 def test_us16(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(us16_same_male_surname(test), [
         ('ANOMALY', 'FAMILY', 'US16', 188, '@F3@',
          "Male Child's surname: Snow is different with father's surname: Stark"
          ),
         ('ANOMALY', 'FAMILY', 'US16', 460, '@F_W_US18_1@',
          "Male Child's surname: Incest is different with father's surname: Poor"
          )
     ])
 def test_us11(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(
         us11_no_bigamy(test),
         [('ERROR', 'INDIVIDUAL', 'US11',
           (180, 189), '@I3@', 'Husband:<@I3@> has one more spouse.'),
          ('ERROR', 'INDIVIDUAL', 'US11',
           (189, 180), '@I3@', 'Husband:<@I3@> has one more spouse.'),
          ('ERROR', 'INDIVIDUAL', 'US11', (415, 421), '@I_W_US17_1@',
           'Husband:<@I_W_US17_1@> has one more spouse.'),
          ('ERROR', 'INDIVIDUAL', 'US11', (421, 415), '@I_W_US17_1@',
           'Husband:<@I_W_US17_1@> has one more spouse.')])
Example #12
0
 def test_us08(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(sorted(us08_birth_before_marriage(test)), [
         ('ANOMALY', 'FAMILY', 'US08', (326, 313), '@F_L_US08_1@',
          'Marriage date 1994-02-02 occurs after children birth 1992-07-16.'
          ),
         ('ANOMALY', 'FAMILY', 'US08', (334, 319), '@F_L_US08_2@',
          'Divorce date 1997-09-18 occurs more than 9 month before children birth 1998-07-16.'
          ),
         ('ANOMALY', 'FAMILY', 'US08', (509, 540), '@F_H_US12_1@',
          'Divorce date 1681-01-01 occurs more than 9 month before children birth 1711-10-11.'
          ),
         ('ANOMALY', 'FAMILY', 'US08', (509, 550), '@F_H_US12_1@',
          'Divorce date 1681-01-01 occurs more than 9 month before children birth 1712-10-22.'
          )
     ])
Example #13
0
 def test_parents_not_too_old(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     # Get returned list sorted to match the result
     self.assertEqual(sorted(
         us12_parents_not_too_old(test)
     ), [(
         'ERROR', 'FAMILY', 'US12', 520, '@I_H_US12_1@',
         'Age of husband is more than 80 when the child @I_H_US12_3@ birth on 1711-10-11.'
     ),
         ('ERROR', 'FAMILY', 'US12', 520, '@I_H_US12_1@',
          'Age of husband is more than 80 when the child @I_H_US12_4@ birth on 1712-10-22.'
          ),
         ('ERROR', 'FAMILY', 'US12', 530, '@I_H_US12_2@',
          'Age of wife is more than 60 when the child @I_H_US12_3@ birth on 1711-10-11.'
          ),
         ('ERROR', 'FAMILY', 'US12', 530, '@I_H_US12_2@',
          'Age of wife is more than 60 when the child @I_H_US12_4@ birth on 1712-10-22.'
          )])
 def test_us08(self):
     path = os.getcwd()
     test = Repository()
     test.get_file_reader(path)
     test.update_individuals()
     test.update_families()
     self.assertEqual(sorted(us09_birth_after_death(test)), [
         ('ANOMALY', 'FAMILY', 'US09', (357, 375), '@F_L_US09_2@',
          "Father's death date 1994-04-04 occurs more than 9 month before child @I_L_US09_6@ birth 1995-07-16."
          ),
         ('ANOMALY', 'FAMILY', 'US09', (522, 540), '@F_H_US12_1@',
          "Father's death date 1700-11-10 occurs more than 9 month before child @I_H_US12_3@ birth 1711-10-11."
          ),
         ('ANOMALY', 'FAMILY', 'US09', (522, 550), '@F_H_US12_1@',
          "Father's death date 1700-11-10 occurs more than 9 month before child @I_H_US12_4@ birth 1712-10-22."
          ),
         ('ERROR', 'FAMILY', 'US09', (349, 369), '@F_L_US09_1@',
          "Mother's death date 1995-05-04 occurs before child @I_L_US09_5@ birth 1996-07-16."
          ),
         ('ERROR', 'FAMILY', 'US09', (532, 550), '@F_H_US12_1@',
          "Mother's death date 1711-11-10 occurs before child @I_H_US12_4@ birth 1712-10-22."
          )
     ])