Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_BlocksCount(self):
sw = mm.sw_high(k=5, gdf=self.df_tessellation, ids="uID")
count = mm.BlocksCount(self.df_tessellation, "bID", sw, "uID").series
count2 = mm.BlocksCount(
self.df_tessellation, self.df_tessellation.bID, sw, "uID"
).series
unweigthed = mm.BlocksCount(
self.df_tessellation, "bID", sw, "uID", weighted=False
).series
check = 3.142437439120778e-05
check2 = 5.222222222222222
assert count.mean() == check
assert count2.mean() == check
assert unweigthed.mean() == check2
with pytest.raises(ValueError):
count = mm.BlocksCount(
self.df_tessellation, "bID", sw, "uID", weighted="yes"
)
sw_drop = mm.sw_high(k=5, gdf=self.df_tessellation[2:], ids="uID")
assert (
mm.BlocksCount(self.df_tessellation, "bID", sw_drop, "uID")
.series.isna()
def test_BlocksCount(self):
sw = mm.sw_high(k=5, gdf=self.df_tessellation, ids="uID")
count = mm.BlocksCount(self.df_tessellation, "bID", sw, "uID").series
count2 = mm.BlocksCount(
self.df_tessellation, self.df_tessellation.bID, sw, "uID"
).series
unweigthed = mm.BlocksCount(
self.df_tessellation, "bID", sw, "uID", weighted=False
).series
check = 3.142437439120778e-05
check2 = 5.222222222222222
assert count.mean() == check
assert count2.mean() == check
assert unweigthed.mean() == check2
with pytest.raises(ValueError):
count = mm.BlocksCount(
self.df_tessellation, "bID", sw, "uID", weighted="yes"
)
sw_drop = mm.sw_high(k=5, gdf=self.df_tessellation[2:], ids="uID")
assert (
mm.BlocksCount(self.df_tessellation, "bID", sw_drop, "uID")
.series.isna()
def test_BlocksCount(self):
sw = mm.sw_high(k=5, gdf=self.df_tessellation, ids="uID")
count = mm.BlocksCount(self.df_tessellation, "bID", sw, "uID").series
count2 = mm.BlocksCount(
self.df_tessellation, self.df_tessellation.bID, sw, "uID"
).series
unweigthed = mm.BlocksCount(
self.df_tessellation, "bID", sw, "uID", weighted=False
).series
check = 3.142437439120778e-05
check2 = 5.222222222222222
assert count.mean() == check
assert count2.mean() == check
assert unweigthed.mean() == check2
with pytest.raises(ValueError):
count = mm.BlocksCount(
self.df_tessellation, "bID", sw, "uID", weighted="yes"
)
sw_drop = mm.sw_high(k=5, gdf=self.df_tessellation[2:], ids="uID")
def test_BlocksCount(self):
sw = mm.sw_high(k=5, gdf=self.df_tessellation, ids="uID")
count = mm.BlocksCount(self.df_tessellation, "bID", sw, "uID").series
count2 = mm.BlocksCount(
self.df_tessellation, self.df_tessellation.bID, sw, "uID"
).series
unweigthed = mm.BlocksCount(
self.df_tessellation, "bID", sw, "uID", weighted=False
).series
check = 3.142437439120778e-05
check2 = 5.222222222222222
assert count.mean() == check
assert count2.mean() == check
assert unweigthed.mean() == check2
with pytest.raises(ValueError):
count = mm.BlocksCount(
self.df_tessellation, "bID", sw, "uID", weighted="yes"
)
sw_drop = mm.sw_high(k=5, gdf=self.df_tessellation[2:], ids="uID")
assert (
).series
unweigthed = mm.BlocksCount(
self.df_tessellation, "bID", sw, "uID", weighted=False
).series
check = 3.142437439120778e-05
check2 = 5.222222222222222
assert count.mean() == check
assert count2.mean() == check
assert unweigthed.mean() == check2
with pytest.raises(ValueError):
count = mm.BlocksCount(
self.df_tessellation, "bID", sw, "uID", weighted="yes"
)
sw_drop = mm.sw_high(k=5, gdf=self.df_tessellation[2:], ids="uID")
assert (
mm.BlocksCount(self.df_tessellation, "bID", sw_drop, "uID")
.series.isna()