예제 #1
0
def search_place(place):
    "Search for place, return constituencies with that name"
    foundplace = geo.constituency(place)
    if foundplace:
        return Constituency.objects.filter(name__in=foundplace,
                                           year=settings.CONSTITUENCY_YEAR)
    else:
        return []
예제 #2
0
 def test_town2(self):
     self.assertEquals("Falkirk", geo.constituency("Alloa"))
예제 #3
0
 def test_town1(self):
     # you can search for a town
     self.assertEquals("Crewe & Nantwich", geo.constituency("Crewe"))
예제 #4
0
 def test_postcode_forces(self):
     # Postcodes run by the British forces post office . We can't
     # do anything with these (they don't point towards a
     # constituency)
     self.assertEquals(None, geo.constituency("BFPO 801"))
예제 #5
0
 def test_postcode_nonexistant(self):
     # there are no postcodes that start with D
     self.assertEquals(None, geo.constituency("D7 7QX"))
예제 #6
0
 def test_postcode1(self):
     # Land's End
     self.assertEquals("St Ives", geo.constituency("TR19 7AA"))
예제 #7
0
 def _test_town4(self): # SKIPPED
     # XXX this is broken because the twfy api have no data about Belfast
     self.assertEquals("Belfast", geo.constituency("Forkhill"))
예제 #8
0
 def test_town3(self):
     self.assertEquals("Shipley", geo.constituency("Ilkley"))
예제 #9
0
 def test_haltwhistle(self):
     """ Test for issue 19, names geocoding to locations > 10 miles
     away from a constituency """
     self.assertIn("Hexham", geo.constituency("Haltwhistle"))
예제 #10
0
 def test_postcode1(self):
     """ Test poscode - Land's End """
     self.assertIn("St Ives", geo.constituency("TR19 7AA"))
예제 #11
0
 def test_town1(self):
     """ You can search for a town """
     self.assertIn("Crewe & Nantwich", geo.constituency("Crewe"))