Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 12, 2024
1 parent e50e6e2 commit bb72dd8
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions tests/test_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,11 @@ def test_init_splitter_types(aoi_json):
def test_split_by_square_with_dict(aoi_json, extract_json):
"""Test divide by square from geojson dict types."""
features = split_by_square(
aoi_json.get("features")[0],
meters=50,
osm_extract=extract_json
aoi_json.get("features")[0], meters=50, osm_extract=extract_json
)
assert len(features.get("features")) == 50
features = split_by_square(
aoi_json.get("features")[0].get("geometry"),
meters=50,
osm_extract=extract_json
aoi_json.get("features")[0].get("geometry"), meters=50, osm_extract=extract_json
)
assert len(features.get("features")) == 50

Expand All @@ -81,23 +77,21 @@ def test_split_by_square_with_str(aoi_json, extract_json):
"""Test divide by square from geojson str and file."""
# GeoJSON Dumps
features = split_by_square(
geojson.dumps(aoi_json.get("features")[0]),
meters=50,
osm_extract=extract_json
geojson.dumps(aoi_json.get("features")[0]), meters=50, osm_extract=extract_json
)
assert len(features.get("features")) == 50
# JSON Dumps
features = split_by_square(
json.dumps(aoi_json.get("features")[0].get("geometry")),
meters=50,
osm_extract=extract_json
osm_extract=extract_json,
)
assert len(features.get("features")) == 50
# File
features = split_by_square(
"tests/testdata/kathmandu.geojson",
meters=100,
osm_extract="tests/testdata/kathmandu_extract.geojson"
osm_extract="tests/testdata/kathmandu_extract.geojson",
)
assert len(features.get("features")) == 15

Expand All @@ -121,7 +115,7 @@ def test_split_by_square_with_file_output():
assert len(output_geojson.get("features")) == 50


def test_split_by_square_with_multigeom_input(aoi_multi_json,extract_json):
def test_split_by_square_with_multigeom_input(aoi_multi_json, extract_json):
"""Test divide by square from geojson dict types."""
file_name = uuid4()
outfile = Path(__file__).parent.parent / f"{file_name}.geojson"
Expand Down Expand Up @@ -219,7 +213,18 @@ def test_split_by_square_cli():
outfile = Path(__file__).parent.parent / f"{uuid4()}.geojson"

try:
main(["--boundary", str(infile), "--meters", "100", "--extract", str(extract_geojson), "--outfile", str(outfile)])
main(
[
"--boundary",
str(infile),
"--meters",
"100",
"--extract",
str(extract_geojson),
"--outfile",
str(outfile),
]
)
except SystemExit:
pass

Expand Down

0 comments on commit bb72dd8

Please sign in to comment.