Exemplo n.º 1
0
 def test_get_humidity(self):
     self.assertAlmostEqual(get_humidity(weather_response(
         "DeLHi", "c21be3f5656ccff4a5fb262f334b1867"),
                                         n=1,
                                         t="09:00:00"),
                            80.0,
                            delta=15)
     self.assertAlmostEqual(get_humidity(weather_response(
         "Kolkata", "c21be3f5656ccff4a5fb262f334b1867"),
                                         n=2,
                                         t="18:00:00"),
                            83.0,
                            delta=15)
     self.assertAlmostEqual(get_humidity(weather_response(
         "London", "c21be3f5656ccff4a5fb262f334b1867"),
                                         n=3,
                                         t="09:00:00"),
                            72.0,
                            delta=15)
     self.assertAlmostEqual(get_humidity(weather_response(
         "New York", "c21be3f5656ccff4a5fb262f334b1867"),
                                         n=0,
                                         t="21:00:00"),
                            81.0,
                            delta=15)
     self.assertAlmostEqual(get_humidity(weather_response(
         "Mumbai", "c21be3f5656ccff4a5fb262f334b1867"),
                                         n=4,
                                         t="00:00:00"),
                            99.0,
                            delta=15)
Exemplo n.º 2
0
 def test_get_humidity(self):
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1,
         "03:00:00"),
                            93,
                            delta=5)
     self.assertAlmostEqual(get_humidity(
         weather_response("Kolkata", "2ab136be1543b5789451a5994364c0d3"), 1,
         "06:00:00"),
                            94,
                            delta=5)
     self.assertAlmostEqual(get_humidity(
         weather_response("Chandigarh", "2ab136be1543b5789451a5994364c0d3"),
         2, "09:00:00"),
                            92.5,
                            delta=5)
     self.assertAlmostEqual(get_humidity(
         weather_response("Sydney", "2ab136be1543b5789451a5994364c0d3"), 2,
         "12:00:00"),
                            76,
                            delta=5)
     self.assertAlmostEqual(get_humidity(
         weather_response("London", "2ab136be1543b5789451a5994364c0d3"), 3,
         "18:00:00"),
                            85,
                            delta=5)
 def test_get_humidity(self):
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1,
         '09:00:00'),
                            float(71),
                            delta=5)
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 1,
         '15:00:00'),
                            float(74),
                            delta=5)
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 2,
         '21:00:00'),
                            float(91),
                            delta=5)
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 2,
         '00:00:00'),
                            float(95),
                            delta=5)
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "2ab136be1543b5789451a5994364c0d3"), 3,
         '06:00:00'),
                            float(92),
                            delta=5)
Exemplo n.º 4
0
 def test_get_humidity(self):
     self.assertAlmostEqual(get_humidity(
         (weather_response('Delhi', '2ab136be1543b5789451a5994364c0d3')),
         n=0,
         time='21:00:00'),
                            94,
                            delta=10)
     self.assertAlmostEqual(get_humidity(
         (weather_response('Delhi', '2ab136be1543b5789451a5994364c0d3')),
         n=2,
         time='3:00:00'),
                            94,
                            delta=10)
     self.assertAlmostEqual(get_humidity(
         (weather_response('Delhi', '2ab136be1543b5789451a5994364c0d3')),
         n=1,
         time='12:00:00'),
                            94,
                            delta=10)
     self.assertAlmostEqual(get_humidity(
         (weather_response('Delhi', '2ab136be1543b5789451a5994364c0d3')),
         n=3,
         time='9:00:00'),
                            90,
                            delta=10)
     self.assertAlmostEqual(get_humidity(
         (weather_response('Delhi', '2ab136be1543b5789451a5994364c0d3')),
         n=4,
         time='3:00:00'),
                            92,
                            delta=10)
Exemplo n.º 5
0
 def test_get_humidity(self):
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"),
         "00:00:00", 3),
                            95,
                            delta=50)
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"),
         "00:00:00", 2),
                            95,
                            delta=50)
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"),
         "00:00:00", 2),
                            95,
                            delta=50)
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"),
         "00:00:00", 4),
                            95,
                            delta=50)
     self.assertAlmostEqual(get_humidity(
         weather_response("Delhi", "55caddfec6f90b2b717bb37ceab8abb0"),
         "00:00:00", 0),
                            95,
                            delta=50)
 def test_get_humidity(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_humidity(json, 0, t[0]), 95, delta=45)
     self.assertAlmostEqual(get_humidity(json, 1, t[1]), 95, delta=45)
     self.assertAlmostEqual(get_humidity(json, 2, t[2]), 95, delta=45)
     self.assertAlmostEqual(get_humidity(json, 3, t[3]), 95, delta=45)
     self.assertAlmostEqual(get_humidity(json, 4, t[4]), 95, delta=45)
	def test_get_humidity(self):
		""" test_get_humidity tests the get_humidity 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_humidity(string1,0,"21:00:00"),92,delta=5)
		self.assertAlmostEqual(get_humidity(string2,4,"09:00:00"),71,delta=5)
		self.assertAlmostEqual(get_humidity(string3,3,"06:00:00"),84,delta=5)
		self.assertAlmostEqual(get_humidity(string4,1,"03:00:00"),60,delta=5)
		self.assertAlmostEqual(get_humidity(string5,2,"00:00:00"),100,delta=5)
Exemplo n.º 8
0
 def test_get_humidity(self):
     self.assertAlmostEqual(get_humidity(str(weather_response("Oxford")), 4,
                                         "15:00:00"),
                            86,
                            delta=5)
     self.assertAlmostEqual(get_humidity(
         str(weather_response("Los+Angeles")), 1, "09:00:00"),
                            87,
                            delta=5)
     self.assertAlmostEqual(get_humidity(str(weather_response("Amritsar")),
                                         0, "21:00:00"),
                            95,
                            delta=5)
     self.assertAlmostEqual(get_humidity(str(weather_response("Brussels")),
                                         3, "00:00:00"),
                            86,
                            delta=5)
     self.assertAlmostEqual(get_humidity(str(weather_response("Kathmandu")),
                                         2, "12:00:00"),
                            87,
                            delta=5)
Exemplo n.º 9
0
 def test_get_humidity(self):
     self.assertAlmostEqual(get_humidity(weather_response("Delhi"), 4,
                                         "03:00:00"),
                            98,
                            delta=5)
     self.assertAlmostEqual(get_humidity(weather_response("London"), 4,
                                         "06:00:00"),
                            85,
                            delta=5)
     self.assertAlmostEqual(get_humidity(weather_response("Monza"), 4,
                                         "12:00:00"),
                            70,
                            delta=5)
     self.assertAlmostEqual(get_humidity(weather_response("Berlin"), 4,
                                         "15:00:00"),
                            61,
                            delta=5)
     self.assertAlmostEqual(get_humidity(weather_response("Venice"), 4,
                                         "18:00:00"),
                            90,
                            delta=5)
Exemplo n.º 10
0
 def test_get_humidity(self):
     self.assertAlmostEqual(get_humidity(
         weather_response('Delhi', 'e6205c85b5958567349335aeb1cee7df'), 1,
         '3:00:00'),
                            88,
                            delta=10)
     self.assertAlmostEqual(get_humidity(
         weather_response('Lucknow', 'e6205c85b5958567349335aeb1cee7df'), 2,
         '6:00:00'),
                            90,
                            delta=10)
     self.assertAlmostEqual(get_humidity(
         weather_response('Jaipur', 'e6205c85b5958567349335aeb1cee7df'), 3,
         '9:00:00'),
                            86,
                            delta=10)
     self.assertAlmostEqual(get_humidity(
         weather_response('Allahabad', 'e6205c85b5958567349335aeb1cee7df'),
         1, '12:00:00'),
                            80,
                            delta=10)
Exemplo n.º 11
0
	def test_get_humidity(self):
		self.assertAlmostEqual(get_humidity(jsonURL, 4, "00:00:00"),94,delta=1)
		self.assertAlmostEqual(get_humidity(jsonURL, 1, "18:00:00"),87,delta=1)
		self.assertAlmostEqual(get_humidity(jsonURL, 2),92,delta=1)
		self.assertAlmostEqual(get_humidity(jsonURL, t="18:00:00"),97,delta=1)
		self.assertAlmostEqual(get_humidity(jsonURL, 1, "06:00:00"),87,delta=1)
		self.assertAlmostEqual(get_humidity(jsonURL, 0, "09:00:00"),77,delta=1)
Exemplo n.º 12
0
	def test_get_humidity(self):
		self.assertAlmostEqual((get_humidity(weather_response("Delhi","1b51de2b8b1a00efe9e9d1c5cdd5c759"),4,"03:00:00")),66,delta=20)
		self.assertAlmostEqual((get_humidity(weather_response("Mumbai","1b51de2b8b1a00efe9e9d1c5cdd5c759"),2,"12:00:00")),99,delta=55)
		self.assertAlmostEqual((get_humidity(weather_response("Ludhiana","1b51de2b8b1a00efe9e9d1c5cdd5c759"),1,"06:00:00")),88,delta=55)
		self.assertAlmostEqual((get_humidity(weather_response("Australia","1b51de2b8b1a00efe9e9d1c5cdd5c759"),3,"09:00:00")),77,delta=55)
		self.assertAlmostEqual((get_humidity(weather_response("India","1b51de2b8b1a00efe9e9d1c5cdd5c759"),0,"21:00:00")),98,delta=55)
Exemplo n.º 13
0
 def test_get_humidity(self):
     self.assertAlmostEqual(get_humidity(json1, 2, "15:00:00"),
                            100,
                            delta=5)
     self.assertAlmostEqual(get_humidity(json2, 3, "06:00:00"), 94, delta=5)
     self.assertAlmostEqual(get_humidity(json3, 4, "21:00:00"), 56, delta=5)
Exemplo n.º 14
0
	def test_get_humidity(self):
		self.assertAlmostEqual(get_humidity(x, 0, '06:00:00'),89,delta=5)
		self.assertAlmostEqual(get_humidity(x, 0, '09:00:00'),80,delta=5)
		self.assertAlmostEqual(get_humidity(x, 0, '12:00:00'),77,delta=5)
		self.assertAlmostEqual(get_humidity(x, 0, '15:00:00'),84,delta=5)
		self.assertAlmostEqual(get_humidity(x, 0, '18:00:00'),88,delta=5)