Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise error line num problem fix for jy #66

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions models/Family.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def dfs(family, last_name):
if not child.get_name(): raise AttributeError("Child's name is missing")
if child.get_name().split('/')[1] != last_name:
#return False
raise Error('ERROR', 'FAMILY', 'US16', child.get_lineNum()['NAME'], f"Male Child's last name {child.get_name().split('/')[1]} doesn't match family last name {last_name}")
raise Error('ERROR', 'FAMILY', 'US16', child.get_lineNum()['NAME'] if "NAME" in child.get_lineNum() else "N/A", f"Male Child's last name {child.get_name().split('/')[1]} doesn't match family last name {last_name}")
for fam in child.get_family():
flag = dfs(fam, check_last_name) and flag
return flag
Expand All @@ -354,7 +354,7 @@ def siblings_should_not_marry(self):
"Missing husband and wife parent")
if not self._husband.get_parent_family().get_id() == self._wife.get_parent_family().get_id():
return True
else:raise Error('ERROR', 'FAMILY', 'US18', self.get_lineNum()['FAM ID'], f"Siblings in family {self.get_id()} are married.")
else:raise Error('ERROR', 'FAMILY', 'US18', self.get_lineNum()['FAM ID'] if "FAM ID" in self.get_lineNum() else "N/A", f"Siblings in family {self.get_id()} are married.")

#US28 List siblings in families by decreasing age, i.e. oldest siblings first
def order_siblings_by_age(self):
Expand Down
3 changes: 2 additions & 1 deletion models/Gedcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def list_multiple_births(self):
if len(list1)>1 :
multiple_birth.append(list1)
return multiple_birth

# def list_living_single(self):
# from Individual import Individual
# singlePeople=[]
Expand Down Expand Up @@ -546,6 +546,7 @@ def list_multiple_births(self):
# else:
# family.set_husband(individual)


if __name__ == "__main__":
SUPPORT_TAGS = {"INDI", "NAME", "SEX", "BIRT", "DEAT", "FAMC", "FAMS", "FAM", "MARR", "HUSB", "WIFE", "CHIL",
"DIV", "DATE", "HEAD", "TRLR", "NOTE"}
Expand Down
6 changes: 3 additions & 3 deletions models/Individual.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def birth_before_marriage(self):
timedelta = date(*family.get_marriedDate()) - date(*self._birthDate)
if (timedelta.days <= 0):
#return False
raise Error('ERROR', 'INDIVIDUAL', 'US02', self.get_lineNum()['BIRT'], f" Individual's Birthday {self.get_birthDate()} is after marriage date of Family {family.get_marriedDate()}")
raise Error('ERROR', 'INDIVIDUAL', 'US02', self.get_lineNum()['BIRT'] if "BIRT" in self.get_lineNum() else "N/A", f" Individual's Birthday {self.get_birthDate()} is after marriage date of Family {family.get_marriedDate()}")
return True

#US03 Birth should occur before death of an individual
Expand All @@ -126,7 +126,7 @@ def birth_before_death(self):

if (date(*self._deathDate) - date(*self._birthDate)).days > 0:
return True
else: raise Error('ERROR', 'INDIVIDUAL', 'US03', self.get_lineNum()['BIRT'], f" Individual's Birthday {self.get_birthDate()} is after individual's death date {self.get_deathDate()}")
else: raise Error('ERROR', 'INDIVIDUAL', 'US03', self.get_lineNum()['BIRT'] if "BIRT" in self.get_lineNum() else "N/A", f" Individual's Birthday {self.get_birthDate()} is after individual's death date {self.get_deathDate()}")

#US07 Death should be less than 150 years after birth for dead people, and current date should be less than 150 years after birth for all living people
def less_then_150_years_old(self):
Expand Down Expand Up @@ -284,7 +284,7 @@ def dfs(indi):
if child in spouse:
#return False
raise Error('ERROR', 'INDIVIDUAL', 'US17',
child.get_lineNum()['INDI ID'],
child.get_lineNum()['INDI ID'] if "IND ID" in child.get_lineNum() else "N/A",
f"Parent is married to a descendant {child.get_id()}")
result = dfs(child) and result
return result
Expand Down
219 changes: 219 additions & 0 deletions testing_files/jack.ged
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
0 NOTE Yijie Yang 10446659
0 @I1@ INDI
1 NAME Jay /Pritchett/
1 SEX M
1 BIRT
2 DATE 2 JAN 1945
1 FAMS @F1@
1 FAMS @F2@
0 @I2@ INDI
1 NAME Gloria /Pritchett/
1 SEX F
1 BIRT
2 DATE 12 DEC 1970
1 FAMS @F1@
1 FAMS @F3@
0 @I3@ INDI
1 NAME Mitchell /Pritchett/
1 SEX M
1 BIRT
2 DATE 9 AUG 1975
1 FAMS @F4@
1 FAMC @F2@
0 @I4@ INDI
1 NAME Cameron /Tucker/
1 SEX F
1 BIRT
2 DATE 29 FEB 1972
1 FAMS @F4@
1 FAMC @F5@
0 @I5@ INDI
1 NAME Claire /Pritchett/
1 SEX F
1 BIRT
2 DATE 11 NOV 1969
1 FAMS @F6@
1 FAMC @F2@
0 @I6@ INDI
1 NAME Phil /Dunphy/
1 SEX M
1 BIRT
2 DATE 12 FEB 1968
1 FAMS @F6@
1 FAMC @F7@
0 @I7@ INDI
1 NAME Joe /Pritchett/
1 SEX M
1 BIRT
2 DATE 16 JAN 2013
1 FAMC @F1@
0 @I8@ INDI
1 NAME Javier /Delgado/
1 SEX M
1 BIRT
2 DATE 10 MAY 1969
1 FAMS @F3@
0 @I9@ INDI
1 NAME Dede /Prichett/
1 SEX F
1 BIRT
2 DATE 31 DEC 1949
1 DEAT Y
2 DATE 3 SEP 2019
1 FAMS @F2@
0 @I10@ INDI
1 NAME Manny /Delgado/
1 SEX M
1 BIRT
2 DATE 4 APR 2002
1 FAMC @F3@
0 @I11@ INDI
1 NAME Lilly /Pritchett/
1 SEX F
1 BIRT
2 DATE 14 FEB 2008
1 FAMC @F4@
0 @I12@ INDI
1 NAME Alex /Dunphy/
1 SEX F
1 BIRT
2 DATE 15 MAR 1998
1 FAMC @F6@
0 @I13@ INDI
1 NAME Luke /Dunphy/
1 SEX M
1 BIRT
2 DATE 28 NOV 2002
1 FAMC @F6@
0 @I14@ INDI
1 NAME Haley /Dunphy/
1 SEX F
1 BIRT
2 DATE 10 DEC 1993
1 FAMS @F8@
1 FAMC @F6@
0 @I15@ INDI
1 NAME Dylan /Marshall/
1 SEX M
1 BIRT
2 DATE 20 AUG 1993
1 FAMS @F8@
1 FAMC @F9@
0 @I16@ INDI
1 NAME Frank /Dunphy/
1 SEX M
1 BIRT
2 DATE 12 JUL 1945
1 FAMS @F7@
1 FAMS @F10@
0 @I17@ INDI
1 NAME Lorraine /Dunphy/
1 SEX F
1 BIRT
2 DATE 10 SEP 1955
1 FAMS @F10@
0 @I18@ INDI
1 NAME Grace /Dunphy/
1 SEX F
1 BIRT
2 DATE 7 JUN 1948
1 DEAT Y
2 DATE 20 DEC 2013
1 FAMS @F7@
0 @I19@ INDI
1 NAME Merle /Tucker/
1 SEX M
1 BIRT
2 DATE 18 APR 1945
1 DEAT Y
2 DATE 13 JUN 2004
1 FAMS @F5@
0 @I20@ INDI
1 NAME Barb /Tucker/
1 SEX F
1 BIRT
2 DATE 24 NOV 1945
1 FAMS @F5@
0 @I21@ INDI
1 NAME Ben /Marshall/
1 SEX M
1 BIRT
2 DATE 20 OCT 1968
1 FAMS @F9@
0 @I22@ INDI
1 NAME Farrah /Marshall/
1 SEX F
1 BIRT
2 DATE 15 SEP 1968
1 FAMS @F9@
0 @I23@ INDI
1 NAME Jake /Marshall/
1 SEX M
1 BIRT
2 DATE 5 SEP 2019
1 FAMC @F8@
0 @F1@ FAM
1 HUSB @I1@
1 WIFE @I2@
1 CHIL @I7@
1 MARR
2 DATE 2 AUG 2008
0 @F2@ FAM
1 HUSB @I1@
1 WIFE @I9@
1 CHIL @I3@
1 CHIL @I5@
1 MARR
2 DATE 6 JUN 1968
1 DIV
2 DATE 17 JUL 2003
0 @F3@ FAM
1 HUSB @I8@
1 WIFE @I2@
1 CHIL @I10@
1 MARR
2 DATE 14 FEB 1995
1 DIV
2 DATE 4 OCT 2006
0 @F4@ FAM
1 HUSB @I3@
1 WIFE @I4@
1 CHIL @I11@
1 MARR
2 DATE 8 JUN 2005
0 @F5@ FAM
1 HUSB @I19@
1 WIFE @I20@
1 CHIL @I4@
0 @F6@ FAM
1 HUSB @I6@
1 WIFE @I5@
1 CHIL @I12@
1 CHIL @I13@
1 CHIL @I14@
1 MARR
2 DATE 13 JAN 1992
0 @F7@ FAM
1 HUSB @I16@
1 WIFE @I18@
1 CHIL @I6@
1 MARR
2 DATE 15 FEB 2017
0 @F8@ FAM
1 HUSB @I15@
1 WIFE @I14@
1 CHIL @I23@
1 MARR
2 DATE 13 MAY 2019
0 @F9@ FAM
1 HUSB @I21@
1 WIFE @I22@
1 CHIL @I15@
1 MARR
2 DATE 5 JAN 1992
0 @F10@ FAM
1 HUSB @I16@
1 WIFE @I17@
1 MARR
2 DATE 6 JAN 1966
0 TRLR