def test_byRank_veryLowRank(self):
     self.assertEqual(
         date(2004, 11, 22),
         dateByWorldPopulationRank('female', 'World', date(2004, 11, 22),
                                   10000))
     self.assertEqual(
         date(2014, 1, 1),
         dateByWorldPopulationRank('male', 'World', date(2014, 1, 1), 300))
示例#2
0
def date_by_world_population_rank(request, dob, sex, country, rank):
    """ Calculates the day on which a person with the given date of birth, sex and country of origin has reached (or will reach) a certain world population rank.<p>The world population rank is defined as the position of someone's birthday among the group of living people of the same sex and country of origin, ordered by date of birth increasing. The first person born is assigned rank #1.<p>
        Please see <a href="/">the full API browser</a> for more information.
    """
    calcdate = dateByWorldPopulationRank(sex, country, dob, rank)
    return Response({
        'dob': dob,
        'sex': sex,
        'country': country,
        'rank': rank,
        'date_on_rank': calcdate
    })
示例#3
0
def date_by_world_population_rank(request, dob, sex, country, rank):
    """ Calculates the day on which a person with the given date of birth, sex and country of origin has reached (or will reach) a certain world population rank.<p>The world population rank is defined as the position of someone's birthday among the group of living people of the same sex and country of origin, ordered by date of birth increasing. The first person born is assigned rank #1.<p>
        Please see <a href="/">the full API browser</a> for more information.
    """
    calcdate = dateByWorldPopulationRank(sex, country, dob, rank)
    return Response({'dob': dob, 'sex': sex, 'country': country, 'rank': rank, 'date_on_rank': calcdate})
示例#4
0
 def test_byRank(self):
     self.assertEqual(date(2049,  3, 11), dateByWorldPopulationRank('unisex', 'World', date(1993, 12,  6), 7000000000))
示例#5
0
 def test_byRank_veryHighRank(self):
     self.assertEqual(date(2027, 11, 29), dateByWorldPopulationRank('unisex', 'World', date(2004, 11, 22), 3000000000))
示例#6
0
 def test_byRank_veryLowRank(self):
     self.assertEqual(date(2004, 11, 22), dateByWorldPopulationRank('female', 'World', date(2004, 11, 22), 10000))
     self.assertEqual(date(2014,  1,  1), dateByWorldPopulationRank('male',   'World', date(2014,  1,  1), 300))
 def test_byRank_veryHighRank(self):
     self.assertEqual(
         date(2027, 11, 29),
         dateByWorldPopulationRank('unisex', 'World', date(2004, 11, 22),
                                   3000000000))
 def test_byRank(self):
     self.assertEqual(
         date(2049, 3, 11),
         dateByWorldPopulationRank('unisex', 'World', date(1993, 12, 6),
                                   7000000000))