def test_no_space_len6_siiiss_valid(self): ''' A valid string of length 6 with no spaces should return the list of postcode patterns. The string is in the format siiiss where s is a letter and i is a digit. ''' postcode_patterns = SearchListings().postcode_permutations('e145bb') self.assertEqual(postcode_patterns, ['E14 5BB'])
def test_no_space_len5_invalid(self): postcode_patterns = SearchListings().postcode_permutations('1e140bb') self.assertEqual(postcode_patterns, [''])
def test_no_space_len7_valid(self): ''' A valid string of length 7 with no spaces should return the list of postcode patterns. ''' postcode_patterns = SearchListings().postcode_permutations('sw115bb') self.assertEqual(postcode_patterns, ['SW11 5BB'])
def test_no_space_len3_invalid(self): ''' An invalid string of length 4 with no spaces should ['']. ''' postcode_patterns = SearchListings().postcode_permutations('e1e1') self.assertEqual(postcode_patterns, [''])
def test_1_space_len_8_valid(self): ''' A string in the correct postcode format of length 8 which has 1 space should return itself in a list. ''' postcode_patterns = SearchListings().postcode_permutations('sw11 5bb') self.assertEqual(postcode_patterns, ['SW11 5BB'])
def test_1_space_len_8_invalid(self): ''' A string in the wrong postcode format of length 8 which has 1 space should return ['']. ''' postcode_patterns = SearchListings().postcode_permutations('sw1 11bb') self.assertEqual(postcode_patterns, [''])
def test_mutliple_spaces(self): ''' A string with multiple spaces should return [''] ''' postcode_patterns = SearchListings().postcode_permutations('a c de') self.assertEqual(postcode_patterns, [''])
def test_string_too_long(self): ''' A string where the length is greater than 8 should return [''] ''' postcode_patterns = SearchListings().postcode_permutations('abcdefghi') self.assertEqual(postcode_patterns, [''])
def test_string_too_short(self): ''' A string where the length is less than 5 should return [''] ''' postcode_patterns = SearchListings().postcode_permutations('a') self.assertEqual(postcode_patterns, [''])
def test_ireland_cities(self): ''' Test to check that if "ireland" is passed through the function get_city_list that it returns all cities in Ireland ''' cities = SearchListings().get_city_list('ireland') self.assertEqual(self.country_cities()['ireland'], cities)
def test_wales_cities(self): ''' Test to check that if "wales" is passed through the function get_city_list that it returns all cities in England ''' cities = SearchListings().get_city_list('wales') self.assertEqual(self.country_cities()['wales'], cities)