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 []
Example #2
0
 def test_town2(self):
     self.assertEquals("Falkirk", geo.constituency("Alloa"))
Example #3
0
 def test_town1(self):
     # you can search for a town
     self.assertEquals("Crewe & Nantwich", geo.constituency("Crewe"))
Example #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"))
Example #5
0
 def test_postcode_nonexistant(self):
     # there are no postcodes that start with D
     self.assertEquals(None, geo.constituency("D7 7QX"))
Example #6
0
 def test_postcode1(self):
     # Land's End
     self.assertEquals("St Ives", geo.constituency("TR19 7AA"))
Example #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"))
Example #8
0
 def test_town3(self):
     self.assertEquals("Shipley", geo.constituency("Ilkley"))
 def test_haltwhistle(self):
     """ Test for issue 19, names geocoding to locations > 10 miles
     away from a constituency """
     self.assertIn("Hexham", geo.constituency("Haltwhistle"))
 def test_postcode1(self):
     """ Test poscode - Land's End """
     self.assertIn("St Ives", geo.constituency("TR19 7AA"))
 def test_town1(self):
     """ You can search for a town """
     self.assertIn("Crewe & Nantwich", geo.constituency("Crewe"))