示例#1
0
 def test_invalid_postcode(self):
     result = functions.find_stores('xyz', 25)
     self.assertEqual(result, 'Invalid postcode',
                      'invalid postcode should return error message')
示例#2
0
 def test_postcode_outside_of_local_area(self):
     result = functions.find_stores('M3 5AL', 50)
     self.assertEqual(len(result), 0,
                      'Manchester postcode should return 0 stores')
示例#3
0
 def test_north_south_ordering_all_stores(self):
     result = functions.find_stores(self.postcode, 1000)
     self.assertEqual(result[-1]['name'], 'Eastbourne',
                      'most southerly store should be Eastbourne')
示例#4
0
 def test_kingsmeadow_postcode_with_radius_1000(self):
     result = functions.find_stores(self.postcode, 1000)
     self.assertEqual(
         len(result), 94,
         'radius 1000 should return all except Bagshot (has nan values)')
示例#5
0
 def test_north_south_ordering_kingsmeadow_radius_10(self):
     result = functions.find_stores(self.postcode, 10)
     test = (result[-1]['latitude'] == min(store['latitude']
                                           for store in result))
     self.assertTrue(
         test, 'last store in result should have the lowest' + 'latitude')
示例#6
0
 def test_kingsmeadow_postcode_with_radius_10(self):
     result = functions.find_stores(self.postcode, 10)
     self.assertEqual(
         len(result), 6,
         'radius 10 should return 6 stores Brentford, Richmond, Feltham,' +
         ' Wimbledon, New Malden, Walton-on-Thames')
示例#7
0
 def test_kingsmeadow_postcode_with_radius_0(self):
     result = functions.find_stores(self.postcode, 0)
     self.assertEqual(len(result), 0, 'radius 0 should return 0 stores')