def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel(weather_response( "DeLHi", "c21be3f5656ccff4a5fb262f334b1867"), n=1, t="09:00:00"), 1016.4, delta=5) self.assertAlmostEqual(get_sealevel(weather_response( "Kolkata", "c21be3f5656ccff4a5fb262f334b1867"), n=2, t="18:00:00"), 1022.1, delta=5) self.assertAlmostEqual(get_sealevel(weather_response( "London", "c21be3f5656ccff4a5fb262f334b1867"), n=3, t="09:00:00"), 1035.3, delta=5) self.assertAlmostEqual(get_sealevel(weather_response( "New York", "c21be3f5656ccff4a5fb262f334b1867"), n=0, t="21:00:00"), 1033.5, delta=5) self.assertAlmostEqual(get_sealevel(weather_response( "Mumbai", "c21be3f5656ccff4a5fb262f334b1867"), n=4, t="00:00:00"), 1023.6, delta=5)
def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 2, "03:00:00"), 1020, delta=5) self.assertAlmostEqual(get_sealevel( weather_response("Chandigarh", "2ab136be1543b5789451a5994364c0d3"), 1, "06:00:00"), 1020, delta=5) self.assertAlmostEqual(get_sealevel( weather_response("Sydney", "2ab136be1543b5789451a5994364c0d3"), 2, "09:00:00"), 1035, delta=5) self.assertAlmostEqual(get_sealevel( weather_response("Mumbai", "2ab136be1543b5789451a5994364c0d3"), 2, "03:00:00"), 1025, delta=5) self.assertAlmostEqual(get_sealevel( weather_response("Ludhiana", "2ab136be1543b5789451a5994364c0d3"), 2, "15:00:00"), 1018, delta=5)
def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 0, '21:00:00'), float(1020.78), delta=5) self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1, '18:00:00'), float(1017.64), delta=5) self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 2, '00:00:00'), float(1017.88), delta=5) self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 4, '06:00:00'), float(1018.89), delta=5) self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 3, '09:00:00'), float(1019.78), delta=5)
def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel( (weather_response('Harayana', '2ab136be1543b5789451a5994364c0d3')), n=2, time='0:00:00'), 1016.84, delta=10) self.assertAlmostEqual(get_sealevel( (weather_response('Delhi', '2ab136be1543b5789451a5994364c0d3')), n=3, time='12:00:00'), 1020.25, delta=10) self.assertAlmostEqual(get_sealevel( (weather_response('Mumbai', '2ab136be1543b5789451a5994364c0d3')), n=1, time='3:00:00'), 1022.98, delta=10) self.assertAlmostEqual(get_sealevel( (weather_response('Mumbai', '2ab136be1543b5789451a5994364c0d3')), n=3, time='18:00:00'), 1016.44, delta=10) self.assertAlmostEqual(get_sealevel( (weather_response('Jaipur', '2ab136be1543b5789451a5994364c0d3')), n=1, time='12:00:00'), 1016.03, delta=10)
def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "00:00:00", 1), 1000, delta=50) self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "03:00:00", 1), 1000, delta=50) self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "06:00:00", 3), 1000, delta=50) self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "12:00:00", 0), 1000, delta=50) self.assertAlmostEqual(get_sealevel( weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"), "21:00:00", 4), 1000, delta=50)
def test_get_sealevel(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_sealevel(json, 0, t[0]), 1025, delta=50) self.assertAlmostEqual(get_sealevel(json, 1, t[1]), 1025, delta=50) self.assertAlmostEqual(get_sealevel(json, 2, t[2]), 1025, delta=50) self.assertAlmostEqual(get_sealevel(json, 3, t[3]), 1025, delta=50) self.assertAlmostEqual(get_sealevel(json, 4, t[4]), 1025, delta=50)
def test_get_sealevel(self): """ test_get_sealevel tests the get_sealevel 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_sealevel(string1,1,"09:00:00"),1018.25,delta=5) self.assertAlmostEqual(get_sealevel(string2,3,"18:00:00"),1027.84,delta=5) self.assertAlmostEqual(get_sealevel(string3,2,"21:00:00"),1018.66,delta=5) self.assertAlmostEqual(get_sealevel(string4,4,"09:00:00"),1020.12,delta=5) self.assertAlmostEqual(get_sealevel(string5,0,"18:00:00"),1025.33,delta=5)
def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel(json1, 2, "15:00:00"), 1025.6, delta=5) self.assertAlmostEqual(get_sealevel(json2, 3, "06:00:00"), 1022.8, delta=5) self.assertAlmostEqual(get_sealevel(json3, 4, "21:00:00"), 1026.08, delta=5)
def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel(str(weather_response("Kolkata")), 1, "15:00:00"), 1022.7, delta=5) self.assertAlmostEqual(get_sealevel(str(weather_response("Singapore")), 4, "18:00:00"), 1023.72, delta=5) self.assertAlmostEqual(get_sealevel(str(weather_response("Madrid")), 3, "21:00:00"), 1035.18, delta=5) self.assertAlmostEqual(get_sealevel( str(weather_response("North+Carolina")), 1, "09:00:00"), 1026.7, delta=5) self.assertAlmostEqual(get_sealevel(str(weather_response("Dhaka")), 2, "06:00:00"), 1020.85, delta=5)
def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel(weather_response("Delhi"), 4, "03:00:00"), 1016.25, delta=5) self.assertAlmostEqual(get_sealevel(weather_response("London"), 4, "06:00:00"), 1038.35, delta=5) self.assertAlmostEqual(get_sealevel(weather_response("Monza"), 4, "12:00:00"), 1041.42, delta=5) self.assertAlmostEqual(get_sealevel(weather_response("Berlin"), 4, "15:00:00"), 1037.05, delta=5) self.assertAlmostEqual(get_sealevel(weather_response("Venice"), 4, "18:00:00"), 1029.74, delta=5)
def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel( weather_response('Delhi', 'e6205c85b5958567349335aeb1cee7df'), 1, '3:00:00'), 1018.05, delta=10) self.assertAlmostEqual(get_sealevel( weather_response('Lucknow', 'e6205c85b5958567349335aeb1cee7df'), 2, '6:00:00'), 1019.68, delta=10) self.assertAlmostEqual(get_sealevel( weather_response('Jaipur', 'e6205c85b5958567349335aeb1cee7df'), 3, '9:00:00'), 1018.42, delta=10) self.assertAlmostEqual(get_sealevel( weather_response('Allahabad', 'e6205c85b5958567349335aeb1cee7df'), 1, '12:00:00'), 1018.15, delta=10)
def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel(jsonURL, t="12:00:00"),1015.5,delta=1) self.assertAlmostEqual(get_sealevel(jsonURL, 1, "15:00:00"),1018.8,delta=1) self.assertAlmostEqual(get_sealevel(jsonURL, 2),1020.9,delta=1) self.assertAlmostEqual(get_sealevel(jsonURL, 4),1017.6,delta=1) self.assertAlmostEqual(get_sealevel(jsonURL, 3, "06:00:00"),1020.0,delta=1) self.assertAlmostEqual(get_sealevel(jsonURL, 3, "00:00:00"),1018.9,delta=1)
def test_get_sealevel(self): self.assertAlmostEqual((get_sealevel(weather_response("Delhi","1b51de2b8b1a00efe9e9d1c5cdd5c759"),4,"03:00:00")),1030.97,delta=20) self.assertAlmostEqual((get_sealevel(weather_response("Mumbai","1b51de2b8b1a00efe9e9d1c5cdd5c759"),2,"12:00:00")),1023.17,delta=55) self.assertAlmostEqual((get_sealevel(weather_response("Ludhiana","1b51de2b8b1a00efe9e9d1c5cdd5c759"),1,"06:00:00")),1016.55,delta=55) self.assertAlmostEqual((get_sealevel(weather_response("Australia","1b51de2b8b1a00efe9e9d1c5cdd5c759"),3,"09:00:00")),1027.47,delta=55) self.assertAlmostEqual((get_sealevel(weather_response("India","1b51de2b8b1a00efe9e9d1c5cdd5c759"),0,"21:00:00")),1026.35,delta=55)
def test_get_sealevel(self): self.assertAlmostEqual(get_sealevel(x, 0, '06:00:00'),1018.45,delta=5) self.assertAlmostEqual(get_sealevel(x, 0, '09:00:00'),1011.55,delta=5) self.assertAlmostEqual(get_sealevel(x, 0, '12:00:00'),1016.35,delta=5) self.assertAlmostEqual(get_sealevel(x, 0, '15:00:00'),1015.23,delta=5) self.assertAlmostEqual(get_sealevel(x, 0, '18:00:00'),1021.87,delta=5)