Beispiel #1
0
def total_life_expectancy(request, sex, country, dob):
    """ Calculate total life expectancy of a person with given sex, country, and date of birth.<p>Note that this function is implemented based on the remaining life expectancy by picking a reference date based on an age of 35 years. It is therefore of limited accuracy.<p>
        Please see <a href="/">the full API browser</a> for more information.
    """
    total_life_expectancy = lifeExpectancyTotal(sex, country, dob)
    return Response({
        'dob': dob,
        'sex': sex,
        'country': country,
        'total_life_expectancy': total_life_expectancy
    })
Beispiel #2
0
def total_life_expectancy(request, sex, country, dob):
    """ Calculate total life expectancy of a person with given sex, country, and date of birth.<p>Note that this function is implemented based on the remaining life expectancy by picking a reference date based on an age of 35 years. It is therefore of limited accuracy.<p>
        Please see <a href="/">the full API browser</a> for more information.
    """
    total_life_expectancy = lifeExpectancyTotal(sex, country, dob)
    return Response({'dob': dob, 'sex': sex, 'country': country, 'total_life_expectancy': total_life_expectancy})
Beispiel #3
0
 def test_lifeExpectancyTotal(self):
     self.assertAlmostEqual(90.34, lifeExpectancyTotal('female', 'World', date(2015, 6, 30)), places=0)
 def test_lifeExpectancyTotal(self):
     self.assertAlmostEqual(90.34,
                            lifeExpectancyTotal('female', 'World',
                                                date(2015, 6, 30)),
                            places=0)