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_CourtyardIndex(self):
cas = self.df_buildings["cas"] = mm.CourtyardArea(self.df_buildings).series
self.df_buildings["cix"] = mm.CourtyardIndex(self.df_buildings, "cas").series
self.df_buildings["cix_array"] = mm.CourtyardIndex(
self.df_buildings, cas, self.df_buildings.geometry.area
).series
check = self.df_buildings.cas[80] / self.df_buildings.geometry.area[80]
assert self.df_buildings["cix"][80] == check
assert self.df_buildings["cix_array"][80] == check
Polygon(self.df_buildings.geometry[80].exterior).area
- self.df_buildings.geometry[80].area
)
assert self.df_buildings["courtyard_area"][80] == check
area = self.df_buildings.geometry.area
self.df_buildings["courtyard_area"] = mm.CourtyardArea(
self.df_buildings, area
).series
assert self.df_buildings["courtyard_area"][80] == check
self.df_buildings["courtyard_area"] = mm.CourtyardArea(self.df_buildings).series
assert self.df_buildings["courtyard_area"][80] == check
with pytest.raises(KeyError):
self.df_buildings["courtyard_area"] = mm.CourtyardArea(
self.df_buildings, "nonexistent"
)
self.df_buildings["courtyard_area"] = mm.CourtyardArea(
self.df_buildings, "area"
).series
check = (
Polygon(self.df_buildings.geometry[80].exterior).area
- self.df_buildings.geometry[80].area
)
assert self.df_buildings["courtyard_area"][80] == check
area = self.df_buildings.geometry.area
self.df_buildings["courtyard_area"] = mm.CourtyardArea(
self.df_buildings, area
).series
assert self.df_buildings["courtyard_area"][80] == check
self.df_buildings["courtyard_area"] = mm.CourtyardArea(self.df_buildings).series
assert self.df_buildings["courtyard_area"][80] == check
with pytest.raises(KeyError):
self.df_buildings["courtyard_area"] = mm.CourtyardArea(
self.df_buildings, "nonexistent"
)
def test_CourtyardArea(self):
self.df_buildings["area"] = self.df_buildings.geometry.area
self.df_buildings["courtyard_area"] = mm.CourtyardArea(
self.df_buildings, "area"
).series
check = (
Polygon(self.df_buildings.geometry[80].exterior).area
- self.df_buildings.geometry[80].area
)
assert self.df_buildings["courtyard_area"][80] == check
area = self.df_buildings.geometry.area
self.df_buildings["courtyard_area"] = mm.CourtyardArea(
self.df_buildings, area
).series
assert self.df_buildings["courtyard_area"][80] == check
self.df_buildings["courtyard_area"] = mm.CourtyardArea(self.df_buildings).series
assert self.df_buildings["courtyard_area"][80] == check
with pytest.raises(KeyError):
self.df_buildings["courtyard_area"] = mm.CourtyardArea(
self.df_buildings, "nonexistent"
)
def test_CourtyardArea(self):
self.df_buildings["area"] = self.df_buildings.geometry.area
self.df_buildings["courtyard_area"] = mm.CourtyardArea(
self.df_buildings, "area"
).series
check = (
Polygon(self.df_buildings.geometry[80].exterior).area
- self.df_buildings.geometry[80].area
)
assert self.df_buildings["courtyard_area"][80] == check
area = self.df_buildings.geometry.area
self.df_buildings["courtyard_area"] = mm.CourtyardArea(
self.df_buildings, area
).series
assert self.df_buildings["courtyard_area"][80] == check
self.df_buildings["courtyard_area"] = mm.CourtyardArea(self.df_buildings).series
assert self.df_buildings["courtyard_area"][80] == check