Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ways committed Nov 26, 2024
1 parent c552c34 commit 09173cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
DATA_PATH = "./data"
COLLECTION_NAME = "weather_forecast"


def parse_args() -> argparse.Namespace:
"""Parse arguments for grib filename and URL."""
parser = argparse.ArgumentParser()
Expand Down
20 changes: 15 additions & 5 deletions app/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,22 @@ def test_collections(self) -> None:

def test_point(self) -> None:
# Test various coord formats, which should all work
response = client.get(f"/collections/{collection_name}/position?coords=POINT(11 60)")
response = client.get(
f"/collections/{collection_name}/position?coords=POINT(11 60)"
)
self.assertEqual(response.status_code, 200)
response = client.get(f"/collections/{collection_name}/position?coords=POINT(11.0 60.0)")
response = client.get(
f"/collections/{collection_name}/position?coords=POINT(11.0 60.0)"
)
self.assertEqual(response.status_code, 200)
response = client.get(f"/collections/{collection_name}/position?coords=POINT(11. 60.)")
response = client.get(
f"/collections/{collection_name}/position?coords=POINT(11. 60.)"
)
self.assertEqual(response.status_code, 200)

response = client.get(f"/collections/{collection_name}/position?{sample_coords}")
response = client.get(
f"/collections/{collection_name}/position?{sample_coords}"
)
self.assertEqual(response.status_code, 200)
# Test for values in range -> temperature
self.assertTrue(
Expand All @@ -59,7 +67,9 @@ def test_point(self) -> None:
self.assertFalse("null" in response.text)

# Test URL that shouldn't work
response = client.get(f"/collections/{collection_name}/position?coords=POINT(1160)")
response = client.get(
f"/collections/{collection_name}/position?coords=POINT(1160)"
)
self.assertEqual(response.status_code, 422)

# Test redirect (can't test in normal way, as this isn't run on a webserver)
Expand Down

0 comments on commit 09173cb

Please sign in to comment.