def test_coords_index_0_invalid(self): """Test clean_coords if index 0 is invalid.""" response = location.clean_coords(('cow', -81)) self.assertIsNone(response)
def test_coords_tuple_length_is_less_than_two(self): """Test clean_coords returns None if tuple has less than 2 items.""" response = location.clean_coords((81,)) self.assertIsNone(response)
def test_coords_tuple_length_is_greater_than_two(self): """Test clean_coords returns None if tuple has more than 2 items.""" response = location.clean_coords((81, -81, 100)) self.assertIsNone(response)
def test_coords_is_tuple(self): """Test clean_coords with a tuple that has coordinates.""" response = location.clean_coords((81, -81)) self.assertCoordsAreValid(response)
def test_coords_is_list(self): """Test clean_coords with a list that has coordinates.""" response = location.clean_coords([81, -81]) self.assertCoordsAreValid(response)
def test_coords_is_unicode(self): """Test clean_coords with a unicode string that has coordinates.""" response = location.clean_coords(u'81,-81') self.assertCoordsAreValid(response)
def test_coords_is_invalid_unicode(self): """Test clean_coords with a unicode string that doesn't have coords.""" response = location.clean_coords(u'awooga!') self.assertIsNone(response)
def test_coords_is_string(self): """Test clean_coords with a string that has coordinates in it.""" response = location.clean_coords("81,-81") self.assertCoordsAreValid(response)
def test_coords_is_invalid_string(self): """Test clean_coords with a string that does not have coordinates.""" response = location.clean_coords("awooga!") self.assertIsNone(response)
def test_coords_dict_no_lat_no_lng(self): """Test clean_coords if it receives a dict without coordinates.""" response = location.clean_coords({}) self.assertIsNone(response)
def test_coords_dict_no_lng(self): """Test clean_coords if it receives a dict with only longitude.""" response = location.clean_coords({'lat': 1}) self.assertIsNone(response)
def test_coords_dict(self): """Test clean_coords if it receives a dict with coordinates.""" response = location.clean_coords({'lat': 81, 'lng': -81}) self.assertCoordsAreValid(response)
def test_coords_invalid_type(self): """Test clean_coords returns None if it gets an invalid type.""" response = location.clean_coords(1) self.assertIsNone(response)
def test_coords_index_1_invalid(self): """Test clean_coords if index 1 is invalid.""" response = location.clean_coords((81, 'cow')) self.assertIsNone(response)