Exemple #1
0
 def test_data_8(self):
     api_caller = ApiCaller()
     with self.assertRaises(ValueError):
         api_caller.get_data('Norway', 'notData', 2009)
Exemple #2
0
 def test_data_9(self):
     api_caller = ApiCaller()
     with self.assertRaises(KeyError):
         api_caller.get_data('Canada', 'emissions', 1000)
Exemple #3
0
 def test_data_6(self):
     api_caller = ApiCaller()
     with self.assertRaises(TypeError):
         api_caller.get_data('Sweden', 'emissions', True)
Exemple #4
0
 def test_data_7(self):
     api_caller = ApiCaller()
     with self.assertRaises(KeyError):
         api_caller.get_data('NotACountry', 'emissions', 2009)
Exemple #5
0
 def test_data_5(self):
     api_caller = ApiCaller()
     with self.assertRaises(TypeError):
         api_caller.get_data('Belarus', True, 2009)
Exemple #6
0
 def test_data_4(self):
     api_caller = ApiCaller()
     with self.assertRaises(TypeError):
         api_caller.get_data(True, 'emissions', 2009)
Exemple #7
0
 def test_data_3(self):
     api_caller = ApiCaller()
     self.assertEqual(
         0.369,
         api_caller.get_data('Costa Rica', 'emissions_per_capita', 1960))
Exemple #8
0
 def test_data_2(self):
     api_caller = ApiCaller()
     self.assertEqual(58162.287,
                      api_caller.get_data('Norway', 'emissions', 2013))
Exemple #9
0
 def test_data_1(self):
     api_caller = ApiCaller()
     self.assertEqual(9378126,
                      api_caller.get_data('Sweden', 'population', 2010))