def test_yahoo_conditions2(self): """ Attempt to get the weather conditions for an unknown city. Assert that no conditions are returned (None). """ location = "illegal_location" conditions = pyweather.yahoo_conditions(location) self.assertEqual(None, conditions)
def test_yahoo_conditions1(self): """ Get the weather conditions for New York City, NY and verify that the returned object contains the properties: title current_condition current_temp date code """ city_name = "New York City, NY, United States" conditions = pyweather.yahoo_conditions(city_name) expected_keys = ['title', 'current_condition', 'current_temp', 'date', 'code'] actual_keys = conditions.keys() outcome = all(k in actual_keys for k in expected_keys) self.assertTrue(outcome)