Example #1
0
 def test_population(self):
     data = list(populationCount('Brazil', 18, 1980))
     self.assertEqual(1, len(data))
     self.assertEqual(2719710, data[0]['total'])
     data = list(populationCount('Brazil', 18))
     self.assertEqual(151, len(data))
     self.assertEqual(1980, data[30]['year'])
     self.assertEqual(2719710, data[30]['total'])
 def test_population(self):
     data = list(populationCount('Brazil', 18, 1980))
     self.assertEqual(1, len(data))
     self.assertEqual(2719710, data[0]['total'])
     data = list(populationCount('Brazil', 18))
     self.assertEqual(151, len(data))
     self.assertEqual(1980, data[30]['year'])
     self.assertEqual(2719710, data[30]['total'])
Example #3
0
def retrieve_population_table(request, country, age=None, year=None):
    """ Retrieve population table for age group / year / country.<p>
        Please see <a href="/">the full API browser</a> for more information.
    """
    result = populationCount(country, age, year)
    # FIXME: the API currently returns a flat JS array here, which is invalid JSON. The commented out line would fix this, but is currently deactivated as not to break the frontend!
    return Response(result)