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