def test_get_pressure(self): self.assertAlmostEqual(get_pressure(weather_response( "DeLHi", "c21be3f5656ccff4a5fb262f334b1867"), n=1, t="09:00:00"), 992.2, delta=7) self.assertAlmostEqual(get_pressure(weather_response( "Kolkata", "c21be3f5656ccff4a5fb262f334b1867"), n=2, t="18:00:00"), 1020.0, delta=7) self.assertAlmostEqual(get_pressure(weather_response( "London", "c21be3f5656ccff4a5fb262f334b1867"), n=3, t="09:00:00"), 1027.0, delta=7) self.assertAlmostEqual(get_pressure(weather_response( "New York", "c21be3f5656ccff4a5fb262f334b1867"), n=0, t="21:00:00"), 1030.0, delta=7) self.assertAlmostEqual(get_pressure(weather_response( "Mumbai", "c21be3f5656ccff4a5fb262f334b1867"), n=4, t="00:00:00"), 1022.0, delta=7)
def test_get_pressure(self): self.assertAlmostEqual(get_pressure( weather_response("Rohtak", "2ab136be1543b5789451a5994364c0d3"), 3, "03:00:00"), 994, delta=5) self.assertAlmostEqual(get_pressure( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1, "06:00:00"), 995, delta=5) self.assertAlmostEqual(get_pressure( weather_response("Ludhiana", "2ab136be1543b5789451a5994364c0d3"), 2, "09:00:00"), 994, delta=5) self.assertAlmostEqual(get_pressure( weather_response("Mumbai", "2ab136be1543b5789451a5994364c0d3"), 2, "12:00:00"), 1025, delta=5) self.assertAlmostEqual(get_pressure( weather_response("Bathinda", "2ab136be1543b5789451a5994364c0d3"), 3, "18:00:00"), 995, delta=5)
def test_get_pressure(self): self.assertAlmostEqual(get_pressure( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1, '06:00:00'), float(994.67), delta=5) self.assertAlmostEqual(get_pressure( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1, '18:00:00'), float(996.31), delta=5) self.assertAlmostEqual(get_pressure( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 3, '12:00:00'), float(991.33), delta=5) self.assertAlmostEqual(get_pressure( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 2, '00:00:00'), float(992.44), delta=5) self.assertAlmostEqual(get_pressure( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 4, '12:00:00'), float(991.33), delta=5)
def test_get_pressure(self): self.assertAlmostEqual(get_pressure( (weather_response('Jaipur', '2ab136be1543b5789451a5994364c0d3')), n=1, time='9:00:00'), 971.08, delta=10) self.assertAlmostEqual(get_pressure( (weather_response('Raipur', '2ab136be1543b5789451a5994364c0d3')), n=0, time='18:00:00'), 985.62, delta=10) self.assertAlmostEqual(get_pressure( (weather_response('Delhi', '2ab136be1543b5789451a5994364c0d3')), n=2, time='15:00:00'), 995.43, delta=10) self.assertAlmostEqual(get_pressure( (weather_response('Harayana', '2ab136be1543b5789451a5994364c0d3')), n=3, time='3:00:00'), 997.32, delta=10) self.assertAlmostEqual(get_pressure( (weather_response('Jaipur', '2ab136be1543b5789451a5994364c0d3')), n=1, time='12:00:00'), 970.24, delta=10)
def test_get_pressure(self): self.assertAlmostEqual(get_pressure( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "00:00:00", 3), 1000, delta=50) self.assertAlmostEqual(get_pressure( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "00:00:00", 4), 1000, delta=50) self.assertAlmostEqual(get_pressure( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "00:00:00", 0), 1000, delta=50) self.assertAlmostEqual(get_pressure( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "00:00:00", 3), 1000, delta=50) self.assertAlmostEqual(get_pressure( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "00:00:00", 2), 1000, delta=50)
def test_get_pressure(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_pressure(json, 0, t[0]), 975, delta=40) self.assertAlmostEqual(get_pressure(json, 1, t[1]), 975, delta=40) self.assertAlmostEqual(get_pressure(json, 2, t[2]), 975, delta=40) self.assertAlmostEqual(get_pressure(json, 3, t[3]), 975, delta=40) self.assertAlmostEqual(get_pressure(json, 4, t[4]), 975, delta=40)
def test_get_pressure(self): """ test_get_pressure tests the get_pressure 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_pressure(string1,2,"12:00:00"),992.16,delta=5) self.assertAlmostEqual(get_pressure(string2,0,"21:00:00"),1022.39,delta=5) self.assertAlmostEqual(get_pressure(string3,3,"18:00:00"),972.42,delta=5) self.assertAlmostEqual(get_pressure(string4,1,"00:00:00"),963.49,delta=5) self.assertAlmostEqual(get_pressure(string5,4,"03:00:00"),1023.84,delta=5)
def test_get_pressure(self): self.assertAlmostEqual(get_pressure(json1, 2, "15:00:00"), 818.53, delta=5) self.assertAlmostEqual(get_pressure(json2, 3, "06:00:00"), 1008.56, delta=5) self.assertAlmostEqual(get_pressure(json3, 4, "21:00:00"), 880.93, delta=5)
def test_get_pressure(self): self.assertAlmostEqual(get_pressure(str(weather_response("Sao+Paulo")), 1, "15:00:00"), 936.61, delta=5) self.assertAlmostEqual(get_pressure(str(weather_response("Tokyo")), 2, "00:00:00"), 1028.3, delta=5) self.assertAlmostEqual(get_pressure( str(weather_response("Buenos+Aires")), 4, "18:00:00"), 1030.79, delta=5) self.assertAlmostEqual(get_pressure(str(weather_response("Sydney")), 1, "03:00:00"), 1031.88, delta=5) self.assertAlmostEqual(get_pressure(str(weather_response("Dehradun")), 3, "09:00:00"), 860.68, delta=5)
def test_get_pressure(self): self.assertAlmostEqual(get_pressure(weather_response("Delhi"), 4, "03:00:00"), 991.82, delta=5) self.assertAlmostEqual(get_pressure(weather_response("London"), 4, "06:00:00"), 1030.77, delta=5) self.assertAlmostEqual(get_pressure(weather_response("Monza"), 4, "12:00:00"), 1015.1, delta=5) self.assertAlmostEqual(get_pressure(weather_response("Berlin"), 4, "15:00:00"), 1031.42, delta=5) self.assertAlmostEqual(get_pressure(weather_response("Venice"), 4, "18:00:00"), 1029.1, delta=5)
def test_get_pressure(self): self.assertAlmostEqual(get_pressure( weather_response('Delhi', 'e6205c85b5958567349335aeb1cee7df'), 1, '3:00:00'), 993.56, delta=10) self.assertAlmostEqual(get_pressure( weather_response('Lucknow', 'e6205c85b5958567349335aeb1cee7df'), 2, '6:00:00'), 1005.48, delta=10) self.assertAlmostEqual(get_pressure( weather_response('Jaipur', 'e6205c85b5958567349335aeb1cee7df'), 3, '9:00:00'), 972.43, delta=10) self.assertAlmostEqual(get_pressure( weather_response('Allahabad', 'e6205c85b5958567349335aeb1cee7df'), 1, '12:00:00'), 1003.59, delta=10)
def test_get_pressure(self): self.assertAlmostEqual(get_pressure(jsonURL, t="18:00:00"),993.1,delta=1) self.assertAlmostEqual(get_pressure(jsonURL, 1),993.5,delta=1) self.assertAlmostEqual(get_pressure(jsonURL, 2, "09:00:00"),994.4,delta=1) self.assertAlmostEqual(get_pressure(jsonURL, 3, "06:00:00"),995.7,delta=1) self.assertAlmostEqual(get_pressure(jsonURL, 4, "00:00:00"),991.8,delta=1) self.assertAlmostEqual(get_pressure(jsonURL, 3),995.6,delta=1)
def test_get_pressure(self): self.assertAlmostEqual((get_pressure(weather_response("Delhi","1b51de2b8b1a00efe9e9d1c5cdd5c759"),4,"03:00:00")),1005.75,delta=20) self.assertAlmostEqual((get_pressure(weather_response("Mumbai","1b51de2b8b1a00efe9e9d1c5cdd5c759"),2,"12:00:00")),1022.39,delta=55) self.assertAlmostEqual((get_pressure(weather_response("Ludhiana","1b51de2b8b1a00efe9e9d1c5cdd5c759"),1,"06:00:00")),990.27,delta=55) self.assertAlmostEqual((get_pressure(weather_response("Australia","1b51de2b8b1a00efe9e9d1c5cdd5c759"),3,"09:00:00")),1023.76,delta=55) self.assertAlmostEqual((get_pressure(weather_response("India","1b51de2b8b1a00efe9e9d1c5cdd5c759"),0,"21:00:00")),1010.2,delta=55)
def test_get_pressure(self): self.assertAlmostEqual(get_pressure(x, 0, '06:00:00'),98.22,delta=5) self.assertAlmostEqual(get_pressure(x, 0, '09:00:00'),99.0,delta=5) self.assertAlmostEqual(get_pressure(x, 0, '12:00:00'),97.76,delta=5) self.assertAlmostEqual(get_pressure(x, 0, '15:00:00'),96.93,delta=5) self.assertAlmostEqual(get_pressure(x, 0, '18:00:00'),99.99,delta=5)