Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ci/envs/313-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ dependencies:
- python=3.13
- packaging
- tqdm
# - numba
- numba
# testing
- codecov
- pytest
- pytest-cov
- pip
- pip:
- --pre --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple
- numpy
- pandas
- shapely
- git+https://github.com/geopandas/geopandas.git
Expand Down
23 changes: 19 additions & 4 deletions momepy/tests/test_elements.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import uuid

import geopandas as gpd
import libpysal
import numpy as np
import pandas as pd
import pytest
Expand All @@ -14,6 +15,7 @@
import momepy as mm

SHPLY_GE_210 = Version(shapely.__version__) >= Version("2.1.0")
LPS_G_4_13_0 = Version(libpysal.__version__) > Version("4.13.0")


class TestElements:
Expand Down Expand Up @@ -285,22 +287,35 @@ def test_get_nearest_node_missing(self):
def test_buffered_limit(self):
limit = mm.buffered_limit(self.df_buildings, 50)
assert limit.geom_type == "Polygon"
assert pytest.approx(limit.area) == 366525.967849688
exp = 366525.967849688
assert exp == pytest.approx(limit.area)

def test_buffered_limit_adaptive(self):
limit = mm.buffered_limit(self.df_buildings, "adaptive")
assert limit.geom_type == "Polygon"
assert pytest.approx(limit.area) == 355819.18954170
if LPS_G_4_13_0:
exp = 347096.5835217
else:
exp = 355819.1895417
assert exp == pytest.approx(limit.area)

limit = mm.buffered_limit(self.df_buildings, "adaptive", max_buffer=30)
assert limit.geom_type == "Polygon"
assert pytest.approx(limit.area) == 304200.301833294
if LPS_G_4_13_0:
exp = 304712.451361391
else:
exp = 304200.301833294
assert exp == pytest.approx(limit.area)

limit = mm.buffered_limit(
self.df_buildings, "adaptive", min_buffer=30, max_buffer=300
)
assert limit.geom_type == "Polygon"
assert pytest.approx(limit.area) == 357671.831894244
if LPS_G_4_13_0:
exp = 348777.778371144
else:
exp = 357671.831894244
assert exp == pytest.approx(limit.area)

def test_buffered_limit_error(self):
with pytest.raises(
Expand Down
Loading