Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import geopandas as gpd
import momepy as mm
import numpy as np
import pytest
from momepy import sw_high
from pytest import approx
from distutils.version import LooseVersion
try:
import mapclassify
MC_21 = str(mapclassify.__version__) < LooseVersion("2.1.0")
except ImportError:
import pysal
MC_21 = str(pysal.__version__) < LooseVersion("2.1.0")
class TestDiversity:
def setup_method(self):
test_file_path = mm.datasets.get_path("bubenec")
self.df_buildings = gpd.read_file(test_file_path, layer="buildings")
self.df_streets = gpd.read_file(test_file_path, layer="streets")
self.df_tessellation = gpd.read_file(test_file_path, layer="tessellation")
self.df_buildings["height"] = np.linspace(10.0, 30.0, 144)
self.df_tessellation["area"] = mm.Area(self.df_tessellation).series
self.sw = sw_high(k=3, gdf=self.df_tessellation, ids="uID")