예제 #1
0
def marriageAllowed(family, husband, wife):
    allowableMarriage = True
    marriageDate = utils.calcDate(family["MARR"][0])
    wifeAgeAtMarriage = utils.calculateAge(wife, marriageDate)
    husbandAgeAtMarriage = utils.calculateAge(husband, marriageDate)
    if wifeAgeAtMarriage < 14 or husbandAgeAtMarriage < 14:
        allowableMarriage = False
    return allowableMarriage
예제 #2
0
def checkForDiff(family, husband, wife):
    allowableMarriage = True
    marriageDate = utils.calcDate(family["MARR"][0])
    wifeAgeAtMarriage = utils.calculateAge(wife, marriageDate)
    husbandAgeAtMarriage = utils.calculateAge(husband, marriageDate)
    ageDifference = abs(wifeAgeAtMarriage - husbandAgeAtMarriage)
    if (((wifeAgeAtMarriage > husbandAgeAtMarriage) and
         (ageDifference >= husbandAgeAtMarriage))
            or ((wifeAgeAtMarriage < husbandAgeAtMarriage) and
                (ageDifference >= wifeAgeAtMarriage))):
        allowableMarriage = False
    return allowableMarriage
예제 #3
0
 def test_addAge(self):
     currentDate = datetime.date.today()
     indAge = utils.calculateAge(self.underageInd, currentDate)
     includeAge.addAgeToIndividual(self.underageInd)
     self.assertTrue("AGE" in self.underageInd.keys(), "Age was not added")
     self.assertEqual(indAge, self.underageInd["AGE"],
                      "This individual should be %d years old" % (indAge))
예제 #4
0
 def test_calcAge(self):
     currentDate = datetime.date(2000, 8, 10)
     calculatedAge = utils.calculateAge(self.individual, currentDate)
     self.assertEqual(
         calculatedAge, 30,
         'Age was calculated as %d, when it was supposed to be 30' %
         (calculatedAge))
예제 #5
0
def addAgeToIndividual(individual):
    currentDate = datetime.date.today()
    indAge = utils.calculateAge(individual, currentDate)
    individual["AGE"] = indAge
    return