def test_requestless_limits(): gdf = LimitsGeoDataFrame().to_data_frame( answers=[ feature_to_answer( FeatureBuilder().set_id(ID).set_name(FOUND_NAME).set_limit( make_limit_rect()).build_geocoded()) ], queries=[RegionQuery(request=FOUND_NAME)], level_kind=LevelKind.city) assert_row(gdf, names=FOUND_NAME, found_name=FOUND_NAME)
def assert_geo_multiboundary(boundary: DataFrame, index: int, multipolygon: GJMultipolygon, name=FOUND_NAME, found_name=FOUND_NAME): assert_row(df=boundary, index=index, names=name, found_name=found_name, boundary=multipolygon)
def assert_geo_centroid(centroid: DataFrame, index: int, name=FOUND_NAME, found_name=FOUND_NAME, lon=CENTROID_LON, lat=CENTROID_LAT): assert_row(df=centroid, index=index, names=name, found_name=found_name, lon=lon, lat=lat)
def test_requestless_boundaries(): gdf = BoundariesGeoDataFrame().to_data_frame( answers=[ feature_to_answer( FeatureBuilder().set_id(ID).set_name(FOUND_NAME).set_boundary( make_single_point_boundary() ) # dummy geometry to not fail on None property .build_geocoded()) ], queries=[RegionQuery(request=FOUND_NAME)], level_kind=LevelKind.city) assert_row(gdf, names=FOUND_NAME, found_name=FOUND_NAME)
def assert_geo_limit(limit: DataFrame, index: int, name=FOUND_NAME, found_name=FOUND_NAME): assert_row(df=limit, index=index, names=name, found_name=found_name, lon_min=GEO_RECT_MIN_LON, lon_max=GEO_RECT_MAX_LON, lat_min=GEO_RECT_MIN_LAT, lat_max=GEO_RECT_MAX_LAT)
def test_geo_limit_response(): response: SuccessResponse = make_success_response() \ .set_geocoded_features( [ NAMED_FEATURE_BUILDER \ .set_limit(make_limit_rect()) \ .build_geocoded() ] ).build() assert_success_response(response) data_frame: DataFrame = LimitsGeoDataFrame().to_data_frame( answers=features_to_answers(response.features), queries=features_to_queries(response.features), level_kind=LevelKind.city) assert_row(df=data_frame, names=FOUND_NAME, found_name=FOUND_NAME, lon_min=GEO_RECT_MIN_LON, lon_max=GEO_RECT_MAX_LON, lat_min=GEO_RECT_MIN_LAT, lat_max=GEO_RECT_MAX_LAT)