def test_multiple_councils(self): """ We find records for the given postcode in the AddressBase table There are corresponding records in the ONSUD for the UPRNs we found The UPRNs described by this postcode map to more than one local authority Exception of class MultipleCouncilsException should be thrown """ with self.assertRaises(MultipleCouncilsException): geocode("CC11CC")
def test_no_records(self): """ We can't find any records for the given postcode in the AddressBase table We should fall back to centroid-based geocoding using ONSPD """ result = geocode("DD1 1DD") self.assertIsInstance(result, OnspdGeocoder)
def test_valid(self): """ We find records for the given postcode in the AddressBase table There are some corresponding records in the ONSUD for the UPRNs we found Valid result should be returned based on geocoding using AddressBase """ result = geocode("BB1 1BB") self.assertIsInstance(result, AddressBaseGeocoder)
def test_no_codes(self): """ We find records for the given postcode in the AddressBase table but there are no corresponding records in the ONSUD for the UPRNs we found We should fall back to centroid-based geocoding using ONSPD """ result = geocode("AA11AA") self.assertIsInstance(result, OnspdGeocoder)
def test_multiple_councils(self): """ We find records for the given postcode in the AddressBase table There are corresponding records in the uprn to council lookup for the UPRNs we found The UPRNs described by this postcode map to more than one local authority Exception of class MultipleCodesException should be thrown """ self.assertIsInstance(geocode("CC11CC"), AddressBaseGeocoder)
def test_manual_pverride(self): result = geocode("BB1 1BB") self.assertEqual(result.get_code("lad"), "fake temp gss code")