def test_get_temperature(self): self.assertAlmostEqual(get_temperature(weather_response( "DeLHi", "c21be3f5656ccff4a5fb262f334b1867"), n=3, t="06:00:00"), 299.96, delta=7) self.assertAlmostEqual(get_temperature(weather_response( "Kolkata", "c21be3f5656ccff4a5fb262f334b1867"), n=0, t="12:00:00"), 302.9, delta=7) self.assertAlmostEqual(get_temperature(weather_response( "London", "c21be3f5656ccff4a5fb262f334b1867"), n=1, t="00:00:00"), 285.5, delta=10) self.assertAlmostEqual(get_temperature(weather_response( "Mumbai", "c21be3f5656ccff4a5fb262f334b1867"), n=2, t="21:00:00"), 298.8, delta=7) self.assertAlmostEqual(get_temperature(weather_response( "New York", "c21be3f5656ccff4a5fb262f334b1867"), n=4, t="03:00:00"), 294.3, delta=10)
def test_get_temperature(self): self.assertAlmostEqual(get_temperature( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1, "03:00:00"), 300, delta=5) self.assertAlmostEqual(get_temperature( weather_response("Kolkata", "2ab136be1543b5789451a5994364c0d3"), 2, "06:00:00"), 295, delta=5) self.assertAlmostEqual(get_temperature( weather_response("Chandigarh", "2ab136be1543b5789451a5994364c0d3"), 2, "09:00:00"), 299, delta=5) self.assertAlmostEqual(get_temperature( weather_response("Sydney", "2ab136be1543b5789451a5994364c0d3"), 3, "12:00:00"), 294, delta=5) self.assertAlmostEqual(get_temperature( weather_response("Mumbai", "2ab136be1543b5789451a5994364c0d3"), 2, "18:00:00"), 303, delta=5)
def test_get_temperature(self): self.assertAlmostEqual(get_temperature( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1, '09:00:00'), float(301.98), delta=5) self.assertAlmostEqual(get_temperature( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 2, '06:00:00'), float(303.838), delta=5) self.assertAlmostEqual(get_temperature( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 3, '03:00:00'), float(297.475), delta=5) self.assertAlmostEqual(get_temperature( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 4, '09:00:00'), float(306.241), delta=5) self.assertAlmostEqual(get_temperature( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 5, '09:00:00'), float(303.796), delta=5)
def test_get_temperature(self): self.assertAlmostEqual(get_temperature( (weather_response('Harayana', '2ab136be1543b5789451a5994364c0d3')), n=1, time='9:00:00'), 300.645, delta=10) self.assertAlmostEqual(get_temperature( (weather_response('Delhi', '2ab136be1543b5789451a5994364c0d3')), n=2, time='3:00:00'), 301.613, delta=10) self.assertAlmostEqual(get_temperature( (weather_response('Harayana', '2ab136be1543b5789451a5994364c0d3')), n=0, time='18:00:00'), 298.69, delta=10) self.assertAlmostEqual(get_temperature( (weather_response('Delhi', '2ab136be1543b5789451a5994364c0d3')), n=3, time='21:00:00'), 298.905, delta=10) self.assertAlmostEqual(get_temperature( (weather_response('Punjab', '2ab136be1543b5789451a5994364c0d3')), n=4, time='12:00:00'), 299.742, delta=10)
def test_get_temperature(self): self.assertAlmostEqual(get_temperature( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "00:00:00", 1), 300, delta=50) self.assertAlmostEqual(get_temperature( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "03:00:00", 0), 300, delta=50) self.assertAlmostEqual(get_temperature( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "06:00:00", 3), 298, delta=50) self.assertAlmostEqual(get_temperature( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "12:00:00", 2), 300, delta=50) self.assertAlmostEqual(get_temperature( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "21:00:00", 4), 300, delta=50)
def test_get_temperature(self): json = weather_response("Delhi", "5753b64e9e1290004733b7726fb5aa15") t = ["03:00:00", "06:00:00", "09:00:00", "12:00:00", "15:00:00"] self.assertAlmostEqual(get_temperature(json, 0, t[0]), 300, delta=35) self.assertAlmostEqual(get_temperature(json, 1, t[1]), 300, delta=35) self.assertAlmostEqual(get_temperature(json, 2, t[2]), 300, delta=35) self.assertAlmostEqual(get_temperature(json, 3, t[3]), 300, delta=35) self.assertAlmostEqual(get_temperature(json, 4, t[4]), 300, delta=35)
def test_get_temperature(self): """ test_get_temperature tests the get_temperature function of the module a1.py using 5 different test cases. The parameter 'delta=5' of the assertAlmostEqual function allows a variation of plus or minus 5 percent in the returned output and the expected output""" self.assertAlmostEqual(get_temperature(string1,2,"21:00:00"),296.97,delta=5) self.assertAlmostEqual(get_temperature(string2,3,"00:00:00"),292.33,delta=5) self.assertAlmostEqual(get_temperature(string3,1,"03:00:00"),297.51,delta=5) self.assertAlmostEqual(get_temperature(string4,4,"09:00:00"),303.628,delta=5) self.assertAlmostEqual(get_temperature(string5,0,"21:00:00"),301.278,delta=5)
def test_get_temperature(self): self.assertAlmostEqual(get_temperature(json1, 2, "15:00:00"), 287.691, delta=5) self.assertAlmostEqual(get_temperature(json2, 3, "06:00:00"), 301.826, delta=5) self.assertAlmostEqual(get_temperature(json3, 4, "21:00:00"), 284.103, delta=5)
def test_get_temperature(self): self.assertAlmostEqual(get_temperature(str(weather_response("London")), 2, "15:00:00"), 296.35, delta=5) self.assertAlmostEqual(get_temperature( str(weather_response("Shanghai")), 4, "03:00:00"), 301.024, delta=5) self.assertAlmostEqual(get_temperature( str(weather_response("Adelaide")), 0, "21:00:00"), 282.62, delta=5) self.assertAlmostEqual(get_temperature( str(weather_response("Barcelona")), 3, "00:00:00"), 296.423, delta=5) self.assertAlmostEqual(get_temperature( str(weather_response("New+York")), 1, "18:00:00"), 293.239, delta=5)
def test_get_temperature(self): self.assertAlmostEqual(get_temperature(weather_response("Delhi"), 4, "03:00:00"), 300.895, delta=5) self.assertAlmostEqual(get_temperature(weather_response("London"), 4, "06:00:00"), 290.903, delta=5) self.assertAlmostEqual(get_temperature(weather_response("Monza"), 4, "12:00:00"), 299.153, delta=5) self.assertAlmostEqual(get_temperature(weather_response("Berlin"), 4, "15:00:00"), 296.179, delta=5) self.assertAlmostEqual(get_temperature(weather_response("Venice"), 4, "18:00:00"), 303.085, delta=5)
def test_get_temperature(self): self.assertAlmostEqual(get_temperature( weather_response('Delhi', 'e6205c85b5958567349335aeb1cee7df'), 1, '3:00:00'), 299.817, delta=10) self.assertAlmostEqual(get_temperature( weather_response('Lucknow', 'e6205c85b5958567349335aeb1cee7df'), 2, '6:00:00'), 303.939, delta=10) self.assertAlmostEqual(get_temperature( weather_response('Jaipur', 'e6205c85b5958567349335aeb1cee7df'), 3, '9:00:00'), 299.419, delta=10) self.assertAlmostEqual(get_temperature( weather_response('Allahabad', 'e6205c85b5958567349335aeb1cee7df'), 1, '12:00:00'), 302.818, delta=10)
def test_get_temperature(self): self.assertAlmostEqual(get_temperature(jsonURL, 3, "00:00:00"),297.95,delta=1) self.assertAlmostEqual(get_temperature(jsonURL, 0, "12:00:00"),304.45,delta=1) self.assertAlmostEqual(get_temperature(jsonURL, 1, "09:00:00"),304.12,delta=1) self.assertAlmostEqual(get_temperature(jsonURL, 1, "18:00:00"),299.64,delta=1) self.assertAlmostEqual(get_temperature(jsonURL, t="21:00:00"),298.05,delta=1) self.assertAlmostEqual(get_temperature(jsonURL, 4),300.68,delta=1)
def test_get_temperature(self): self.assertAlmostEqual((get_temperature(weather_response("Delhi","1b51de2b8b1a00efe9e9d1c5cdd5c759"),4,"03:00:00")),304.867,delta=20) self.assertAlmostEqual((get_temperature(weather_response("Mumbai","1b51de2b8b1a00efe9e9d1c5cdd5c759"),2,"12:00:00")),299.145,delta=55) self.assertAlmostEqual((get_temperature(weather_response("Ludhiana","1b51de2b8b1a00efe9e9d1c5cdd5c759"),1,"06:00:00")),298.929,delta=55) self.assertAlmostEqual((get_temperature(weather_response("Australia","1b51de2b8b1a00efe9e9d1c5cdd5c759"),3,"09:00:00")),300.605,delta=55) self.assertAlmostEqual((get_temperature(weather_response("India","1b51de2b8b1a00efe9e9d1c5cdd5c759"),0,"21:00:00")),295.46,delta=55)
def test_get_temperature(self): self.assertAlmostEqual(get_temperature(x, 0, '06:00:00'),302.55,delta=5) self.assertAlmostEqual(get_temperature(x, 0, '09:00:00'),302.55,delta=5) self.assertAlmostEqual(get_temperature(x, 0, '12:00:00'),302.55,delta=5) self.assertAlmostEqual(get_temperature(x, 0, '15:00:00'),302.55,delta=5) self.assertAlmostEqual(get_temperature(x, 0, '18:00:00'),302.55,delta=5)