示例#1
0
 def test_emissions_range_3(self):
     api_caller = ApiCaller()
     test_range = {1969: 12112.101, 1970: 21539.958, 1971: 32280.601}
     api_caller.get_data_range('Nigeria', 'emissions', 1969, 1971)
     self.assertEqual(
         test_range,
         api_caller.get_data_range('Nigeria', 'emissions', 1969, 1971))
示例#2
0
 def test_population_range_3(self):
     api_caller = ApiCaller()
     test_range = {
         2005: 16319868,
         2006: 16346101,
         2007: 16381696,
         2008: 16445593
     }
     api_caller.get_data_range('Netherlands', 'population', 2005, 2008)
     self.assertEqual(
         test_range,
         api_caller.get_data_range('Netherlands', 'population', 2005, 2008))
示例#3
0
 def test_emissions_range_2(self):
     api_caller = ApiCaller()
     test_range = {
         1986: 102874.018,
         1987: 103116.04,
         1988: 100354.789,
         1989: 107461.435,
         1990: 106049.64
     }
     self.assertEqual(
         test_range,
         api_caller.get_data_range('Belgium', 'emissions', 1986, 1990))
示例#4
0
 def test_emissions_range_1(self):
     api_caller = ApiCaller()
     test_range = {
         2010: 493207.833,
         2011: 447828.708,
         2012: 468572.927,
         2013: 458250.322,
         2014: 419820.162
     }
     self.assertEqual(
         test_range,
         api_caller.get_data_range('United Kingdom', 'emissions', 2010,
                                   2014))
示例#5
0
 def test_data_range_error_5(self):
     api_caller = ApiCaller()
     with self.assertRaises(ValueError):
         api_caller.get_data_range('Nigeria', 'asd', 1969, 1971)
示例#6
0
 def test_data_range_error_4(self):
     api_caller = ApiCaller()
     with self.assertRaises(TypeError):
         api_caller.get_data_range('Nigeria', 'emissions', 1969, False)
示例#7
0
 def test_data_range_error_2(self):
     api_caller = ApiCaller()
     with self.assertRaises(TypeError):
         api_caller.get_data_range('Nigeria', True, 1969, 1971)
示例#8
0
 def test_data_range_error_1(self):
     api_caller = ApiCaller()
     with self.assertRaises(TypeError):
         api_caller.get_data_range(True, 'emissions', 1969, 1971)
示例#9
0
 def test_population_range_2(self):
     api_caller = ApiCaller()
     test_range = {2007: 7180100, 2008: 7308800}
     self.assertEqual(
         test_range,
         api_caller.get_data_range('Israel', 'population', 2007, 2008))
示例#10
0
 def test_population_range_1(self):
     api_caller = ApiCaller()
     test_range = {2009: 71339185, 2010: 72326914, 2011: 73409455}
     self.assertEqual(
         test_range,
         api_caller.get_data_range('Turkey', 'population', 2009, 2011))