Skip to content

Commit

Permalink
chore: apply CR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
RaczeQ committed Mar 10, 2023
1 parent 812a570 commit 8b9859d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/neighbourhoods/test_adjacency_neighbourhood.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

@pytest.fixture # type: ignore
def no_geometry_gdf() -> gpd.GeoDataFrame:
"""Get empty GeoDataFrame."""
"""Get GeoDataFrame with no geometry."""
return gpd.GeoDataFrame()


@pytest.fixture # type: ignore
def empty_gdf() -> gpd.GeoDataFrame:
"""Get GeoDataFrame with no geometry."""
"""Get empty GeoDataFrame."""
return gpd.GeoDataFrame(geometry=[])


Expand Down Expand Up @@ -102,6 +102,16 @@ def test_lazy_loading_empty_set(squares_regions_fixture: gpd.GeoDataFrame) -> No
assert neighbourhood.lookup == {}


def test_adjacency_lazy_loading(rounded_regions_fixture: gpd.GeoDataFrame) -> None:
"""Test checks if lookup table is lazily populated."""
neighbourhood = AdjacencyNeighbourhood(rounded_regions_fixture)
neighbours = neighbourhood.get_neighbours("SW")
assert neighbours == {"W", "S"}
assert neighbourhood.lookup == {
"SW": {"W", "S"},
}


def test_generate_all_neighbourhoods_rounded_regions(
rounded_regions_fixture: gpd.GeoDataFrame,
) -> None:
Expand Down Expand Up @@ -140,16 +150,6 @@ def test_generate_all_neighbourhoods_squares_regions(
}


def test_adjacency_lazy_loading(rounded_regions_fixture: gpd.GeoDataFrame) -> None:
"""Test checks if lookup table is lazily populated."""
neighbourhood = AdjacencyNeighbourhood(rounded_regions_fixture)
neighbours = neighbourhood.get_neighbours("SW")
assert neighbours == {"W", "S"}
assert neighbourhood.lookup == {
"SW": {"W", "S"},
}


@pytest.mark.parametrize( # type: ignore
"index, distance, neighbours_expected",
[
Expand Down

0 comments on commit 8b9859d

Please sign in to comment.