示例#1
0
 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'])
示例#2
0
 def test_no_space_len5_invalid(self):
     postcode_patterns = SearchListings().postcode_permutations('1e140bb')
     self.assertEqual(postcode_patterns, [''])
示例#3
0
 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'])
示例#4
0
 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, [''])
示例#5
0
 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'])
示例#6
0
 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, [''])
示例#7
0
 def test_mutliple_spaces(self):
     '''
     A string with multiple spaces should return ['']
     '''
     postcode_patterns = SearchListings().postcode_permutations('a c de')
     self.assertEqual(postcode_patterns, [''])
示例#8
0
 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, [''])
示例#9
0
 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, [''])
示例#10
0
 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)
示例#11
0
 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)