Skip to content

Commit

Permalink
Fixed US13
Browse files Browse the repository at this point in the history
Used to not take into account the year, now it does so it works correctly
  • Loading branch information
kgensheimer committed Oct 24, 2018
1 parent a4b3e4d commit 3052e5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
8 changes: 4 additions & 4 deletions GedcomProject.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ def sibling_spacing(self):
for j in range(i + 1, len(childIDLstCopy)):
child1 = self.individuals[childIDLstCopy[i]]
child2 = self.individuals[childIDLstCopy[j]]
daysApart = abs(child1.birt.day - child2.birt.day)
monthsApart = abs(child1.birt.month - child2.birt.month)
daysApart = abs(child1.birt - child2.birt).days
monthsApart = abs((child1.birt.year - child2.birt.year) * 12 + child1.birt.month - child2.birt.month)
if daysApart > 2 and monthsApart < 8 :
self.all_errors += ["US13: Siblings {} and {}'s births are only ".format(child1.name, child2.name) + str(daysApart) + " days apart"]
self.all_errors += ["US13: Siblings {} and {}'s births are ".format(child1.name, child2.name) + str(daysApart) + " days apart"]


def too_many_births(self):
Expand Down Expand Up @@ -424,7 +424,7 @@ def unique_names_and_bdays(self):
names_and_bdays += [(person.name, person.birt)]

def unique_spouses_in_family(self):
"""US24: Checks to see if only one family has spouses with the same names
"""US24: Checks to see if only one family has spouses with the same names
and marriage dates. Will indicate if there is more than one family with same spouses
and marriage date"""
unique_families = [] # input in the form (husband name, wife name, marriage date)
Expand Down
23 changes: 7 additions & 16 deletions Unit_Test_Proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,12 @@ def test_parents_too_old(self):
def test_sibling_spacing(self):
"""US13: Tests thatbirth dates of siblings should be more than 8 months apart or less than 2 days apart
(twins may be born one day apart, e.g. 11:59 PM and 12:02 AM the following calendar day)"""
list_of_known_errors = ["US13: Siblings One /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Two /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Three /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Four /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Five /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Six /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Seven /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Eight /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Nine /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Ten /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings El /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Twelve /Fif/ and Thirteen /Fif/'s births are only 5 days apart",
"US13: Siblings Thirteen /Fif/ and Fourteen /Fif/'s births are only 5 days apart",
"US13: Siblings Thirteen /Fif/ and Fifteen /Fif/'s births are only 5 days apart",
"US13: Siblings Allen /Leffe/ and Ava /Leffe/'s births are only 9 days apart"]
list_of_known_errors = ["US13: Siblings Allen /Leffe/ and Ava /Leffe/'s births are 68 days apart",
"US13: Siblings Bill /Leffe/ and Lauren /Leffe/'s births are 59 days apart",
"US13: Siblings Jimmy /James/ and Jackie /James/'s births are 45 days apart",
"US13: Siblings Lauren /Leffe/ and Bill /Leffe/'s births are 59 days apart",
"US13: Siblings Thirteen /Fif/ and Fifteen /Fif/'s births are 5 days apart",
"US13: Siblings Thirteen /Fif/ and Fourteen /Fif/'s births are 5 days apart"]
for error in list_of_known_errors:
self.assertIn(error, self.all_errors)

Expand Down Expand Up @@ -164,7 +155,7 @@ def test_unique_spouses_in_family(self):
spouses (by name) and marriage dates"""
list_of_known_errors = [
"US24: The family with spouses Future /Trunks/ and Mai /Trunks/ married on 2045-03-15 occurs more than once in the GEDCOM file.",
"US24: The family with spouses John /Leffe/ and Ava /Leffe/ married on 1980-02-11 occurs more than once in the GEDCOM file."
"US24: The family with spouses John /Leffe/ and Ava /Leffe/ married on 1980-02-11 occurs more than once in the GEDCOM file."
]
for error in list_of_known_errors:
self.assertIn(error, self.all_errors)
Expand Down

0 comments on commit 3052e5b

Please sign in to comment.