def test_get_wind(self): self.assertAlmostEqual(get_wind(weather_response( "DeLHi", "c21be3f5656ccff4a5fb262f334b1867"), n=1, t="09:00:00"), 5.8, delta=5) self.assertAlmostEqual(get_wind(weather_response( "Kolkata", "c21be3f5656ccff4a5fb262f334b1867"), n=2, t="18:00:00"), 3.7, delta=5) self.assertAlmostEqual(get_wind(weather_response( "London", "c21be3f5656ccff4a5fb262f334b1867"), n=3, t="09:00:00"), 5.2, delta=5) self.assertAlmostEqual(get_wind(weather_response( "New York", "c21be3f5656ccff4a5fb262f334b1867"), n=0, t="21:00:00"), 3.9, delta=5) self.assertAlmostEqual(get_wind(weather_response( "Mumbai", "c21be3f5656ccff4a5fb262f334b1867"), n=4, t="00:00:00"), 2.8, delta=5)
def test_get_wind(self): self.assertAlmostEqual(get_wind( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1, "03:00:00"), 2.15, delta=5) self.assertAlmostEqual(get_wind( weather_response("Rohtak", "2ab136be1543b5789451a5994364c0d3"), 2, "06:00:00"), 1.32, delta=5) self.assertAlmostEqual(get_wind( weather_response("Kolkata", "2ab136be1543b5789451a5994364c0d3"), 3, "09:00:00"), 2.00, delta=5) self.assertAlmostEqual(get_wind( weather_response("Bathinda", "2ab136be1543b5789451a5994364c0d3"), 4, "12:00:00"), 1.15, delta=5) self.assertAlmostEqual(get_wind( weather_response("Mumbai", "2ab136be1543b5789451a5994364c0d3"), 2, "15:00:00"), 2.25, delta=5)
def test_get_wind(self): self.assertAlmostEqual(get_wind( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1, '21:00:00'), float(2.76), delta=5) self.assertAlmostEqual(get_wind( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 2, '06:00:00'), float(2.68), delta=5) self.assertAlmostEqual(get_wind( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 3, '06:00:00'), float(2.45), delta=5) self.assertAlmostEqual(get_wind( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 4, '09:00:00'), float(1.95), delta=5) self.assertAlmostEqual(get_wind( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1, '12:00:00'), float(2.99), delta=5)
def test_get_wind(self): self.assertAlmostEqual(get_wind( (weather_response('Harayana', '2ab136be1543b5789451a5994364c0d3')), n=1, time='9:00:00'), 3.91, delta=10) self.assertAlmostEqual(get_wind( (weather_response('Delhi', '2ab136be1543b5789451a5994364c0d3')), n=0, time='18:00:00'), 1.31, delta=10) self.assertAlmostEqual(get_wind( (weather_response('Mumbai', '2ab136be1543b5789451a5994364c0d3')), n=2, time='12:00:00'), 3.68, delta=10) self.assertAlmostEqual(get_wind( (weather_response('Mumbai', '2ab136be1543b5789451a5994364c0d3')), n=3, time='15:00:00'), 4.31, delta=10) self.assertAlmostEqual(get_wind( (weather_response('Punjab', '2ab136be1543b5789451a5994364c0d3')), n=3, time='3:00:00'), 1.42, delta=10)
def test_get_wind(self): self.assertAlmostEqual(get_wind( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "00:00:00", 1), 10, delta=50) self.assertAlmostEqual(get_wind( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "03:00:00", 0), 10, delta=50) self.assertAlmostEqual(get_wind( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "06:00:00", 3), 10, delta=50) self.assertAlmostEqual(get_wind( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "12:00:00", 2), 10, delta=50) self.assertAlmostEqual(get_wind( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "21:00:00", 4), 10, delta=50)
def test_get_wind(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_wind(json, 0, t[0]), 10, delta=10) self.assertAlmostEqual(get_wind(json, 1, t[1]), 10, delta=10) self.assertAlmostEqual(get_wind(json, 2, t[2]), 10, delta=10) self.assertAlmostEqual(get_wind(json, 3, t[3]), 10, delta=10) self.assertAlmostEqual(get_wind(json, 4, t[4]), 10, delta=10)
def test_get_wind(self): """ test_get_wind tests the get_wind 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_wind(string1,3,"21:00:00"),1.31,delta=5) self.assertAlmostEqual(get_wind(string2,1,"15:00:00"),3.02,delta=5) self.assertAlmostEqual(get_wind(string3,0,"18:00:00"),1.62,delta=5) self.assertAlmostEqual(get_wind(string4,4,"06:00:00"),0.27,delta=5) self.assertAlmostEqual(get_wind(string5,2,"06:00:00"),5.56,delta=5)
def test_get_wind(self): self.assertAlmostEqual(get_wind(str(weather_response("Cape+Town")), 1, "09:00:00"), 2.37, delta=5) self.assertAlmostEqual(get_wind(str(weather_response("Mumbai")), 3, "21:00:00"), 4.36, delta=5) self.assertAlmostEqual(get_wind(str(weather_response("Boston")), 4, "00:00:00"), 1.42, delta=5) self.assertAlmostEqual(get_wind(str(weather_response("Panama+City")), 2, "03:00:00"), 3.11, delta=5) self.assertAlmostEqual(get_wind(str(weather_response("Berlin")), 0, "18:00:00"), 1.8, delta=5)
def test_get_wind(self): self.assertAlmostEqual(get_wind(weather_response("Delhi"), 4, "03:00:00"), 1.97, delta=5) self.assertAlmostEqual(get_wind(weather_response("London"), 4, "06:00:00"), 4.46, delta=5) self.assertAlmostEqual(get_wind(weather_response("Monza"), 4, "12:00:00"), 1.92, delta=5) self.assertAlmostEqual(get_wind(weather_response("Berlin"), 4, "15:00:00"), 7.91, delta=5) self.assertAlmostEqual(get_wind(weather_response("Venice"), 4, "18:00:00"), 1.97, delta=5)
def test_get_wind(self): self.assertAlmostEqual(get_wind( weather_response('Delhi', 'e6205c85b5958567349335aeb1cee7df'), 1, '3:00:00'), 4.66, delta=10) self.assertAlmostEqual(get_wind( weather_response('Lucknow', 'e6205c85b5958567349335aeb1cee7df'), 2, '6:00:00'), 2.67, delta=10) self.assertAlmostEqual(get_wind( weather_response('Jaipur', 'e6205c85b5958567349335aeb1cee7df'), 3, '9:00:00'), 2.81, delta=10) self.assertAlmostEqual(get_wind( weather_response('Allahabad', 'e6205c85b5958567349335aeb1cee7df'), 1, '12:00:00'), 1.42, delta=10)
def test_get_wind(self): self.assertAlmostEqual(get_wind(jsonURL, 2, "21:00:00"),2.1,delta=1) self.assertAlmostEqual(get_wind(jsonURL, 3, "06:00:00"),1.4,delta=1) self.assertAlmostEqual(get_wind(jsonURL, t="18:00:00"),3.0,delta=1) self.assertAlmostEqual(get_wind(jsonURL, 1, "15:00:00"),4.1,delta=1) self.assertAlmostEqual(get_wind(jsonURL, 4),1.9,delta=1) self.assertAlmostEqual(get_wind(jsonURL, 4, "12:00:00"),1.6,delta=1)
def test_get_wind(self): self.assertAlmostEqual((get_wind(weather_response("Delhi","1b51de2b8b1a00efe9e9d1c5cdd5c759"),4,"03:00:00")),1.31,delta=5) self.assertAlmostEqual((get_wind(weather_response("Mumbai","1b51de2b8b1a00efe9e9d1c5cdd5c759"),2,"12:00:00")),3.57,delta=5) self.assertAlmostEqual((get_wind(weather_response("Ludhiana","1b51de2b8b1a00efe9e9d1c5cdd5c759"),1,"06:00:00")),1.35,delta=5) self.assertAlmostEqual((get_wind(weather_response("Australia","1b51de2b8b1a00efe9e9d1c5cdd5c759"),3,"09:00:00")),2.9,delta=5) self.assertAlmostEqual((get_wind(weather_response("India","1b51de2b8b1a00efe9e9d1c5cdd5c759"),0,"21:00:00")),2.36,delta=5)
def test_get_wind(self): self.assertAlmostEqual(get_wind(json1, 2, "15:00:00"), 1.8, delta=5) self.assertAlmostEqual(get_wind(json2, 3, "06:00:00"), 4.81, delta=5) self.assertAlmostEqual(get_wind(json3, 4, "21:00:00"), 1.96, delta=5)
def test_get_wind(self): self.assertAlmostEqual(get_wind(x, 0, '06:00:00'),1.67,delta=5) self.assertAlmostEqual(get_wind(x, 0, '09:00:00'),1.68,delta=5) self.assertAlmostEqual(get_wind(x, 0, '12:00:00'),1.52,delta=5) self.assertAlmostEqual(get_wind(x, 0, '15:00:00'),1.99,delta=5) self.assertAlmostEqual(get_wind(x, 0, '18:00:00'),1.75,delta=5)