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))
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))
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))
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))
def test_data_range_error_5(self): api_caller = ApiCaller() with self.assertRaises(ValueError): api_caller.get_data_range('Nigeria', 'asd', 1969, 1971)
def test_data_range_error_4(self): api_caller = ApiCaller() with self.assertRaises(TypeError): api_caller.get_data_range('Nigeria', 'emissions', 1969, False)
def test_data_range_error_2(self): api_caller = ApiCaller() with self.assertRaises(TypeError): api_caller.get_data_range('Nigeria', True, 1969, 1971)
def test_data_range_error_1(self): api_caller = ApiCaller() with self.assertRaises(TypeError): api_caller.get_data_range(True, 'emissions', 1969, 1971)
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))
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))