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_DistanceBand(self):
lp = libpysal.weights.DistanceBand.from_dataframe(self.df_buildings, 100)
lp_ids = libpysal.weights.DistanceBand.from_dataframe(
self.df_buildings, 100, ids="uID"
)
db = mm.DistanceBand(self.df_buildings, 100)
db_ids = mm.DistanceBand(self.df_buildings, 100, ids="uID")
for k in range(len(self.df_buildings)):
assert k in db.neighbors.keys()
assert sorted(lp.neighbors[k]) == sorted(db.neighbors[k])
for k in self.df_buildings.uID:
assert k in db_ids.neighbors.keys()
assert sorted(lp_ids.neighbors[k]) == sorted(db_ids.neighbors[k])
db_cent_false = mm.DistanceBand(self.df_buildings, 100, centroid=False)
assert sorted(db_cent_false.neighbors[0]) == sorted(
[125, 133, 114, 134, 113, 121]