Пример #1
0
class TestAbleToReverseGeocodeToPointAddress(unittest.TestCase):
    def setUp(self):
        self.df = pd.DataFrame({"id": [1], "address": ["100 Legends Way"]})
        self.address = "address"
        self.geocoder = CobArcGISGeocoder(self.df, self.address)
        self.geocode_df = self.geocoder.geocode_df()

    def test_reverse_geocode_to_point_address(self):
        self.assertEqual(self.geocode_df["SAM_ID"][0], 340814)
Пример #2
0
class TestHandlesNotFindingAddressAsExpected(unittest.TestCase):
    def setUp(self):
        self.df = pd.DataFrame({
            "id": [1],
            "address": ["This isn't an address."]
        })
        self.address = "address"
        self.geocoder = CobArcGISGeocoder(self.df, self.address)
        self.geocode_df = self.geocoder.geocode_df()

    def test_reverse_geocode_to_point_address(self):
        self.assertEqual(self.geocode_df["flag"][0],
                         "Unable to geocode to any address.")
Пример #3
0
class TestAbleToFindPointAddress(unittest.TestCase):
    def setUp(self):
        self.df = pd.DataFrame({
            "id": [1],
            "address": ["1 City Hall Plz, Boston, 02108"]
        })
        self.address = "address"
        self.geocoder = CobArcGISGeocoder(self.df, self.address)
        self.geocode_df = self.geocoder.geocode_df()

    def test_returns_expected_address(self):
        print(self.geocode_df["SAM_ID"])
        self.assertEqual(self.geocode_df["SAM_ID"][0], 32856)
Пример #4
0
class TestAbleToHandleNullAddresses(unittest.TestCase):
    def setUp(self):
        self.df = pd.DataFrame({
            "id": [1, 2],
            "address": ["89 Orleans Street Boston MA, 02128", None]
        })
        self.address = "address"
        self.geocoder = CobArcGISGeocoder(self.df, self.address)
        self.geocode_df_with_Nulls = self.geocoder.geocode_df()

    def test_handle_null_address(self):
        self.assertEqual(self.geocode_df_with_Nulls.loc[:, "flag"][1],
                         "No address provided. Unable to geocode.")