From 8b9859d9efd8458943f3094e21b412b08a043cac Mon Sep 17 00:00:00 2001 From: Kamil Raczycki Date: Fri, 10 Mar 2023 08:40:00 +0100 Subject: [PATCH] chore: apply CR suggestions --- .../test_adjacency_neighbourhood.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/neighbourhoods/test_adjacency_neighbourhood.py b/tests/neighbourhoods/test_adjacency_neighbourhood.py index 644e1117..07c3b436 100644 --- a/tests/neighbourhoods/test_adjacency_neighbourhood.py +++ b/tests/neighbourhoods/test_adjacency_neighbourhood.py @@ -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=[]) @@ -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: @@ -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", [