Skip to content

Commit

Permalink
feat:Updates forecast function output to 3 columns
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Forecast function now retuns a facet plot with 3 columns
  • Loading branch information
christopheralex committed Jan 29, 2022
1 parent 08c203c commit 14a91d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/airpyllution/airpyllution.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ def get_pollution_forecast(lat, lon, api_key):
y=alt.Y("Concentration", title="Concentration"),
color=alt.Color("Pollutants"),
)
.properties(width=180, height=180)
.facet(facet="Pollutants:N", columns=4)
.properties(width=100, height=100)
.facet(facet="Pollutants:N", columns=3)
.resolve_axis(x="independent", y="independent")
.resolve_scale(x="independent", y="independent")
.properties(
Expand Down
18 changes: 4 additions & 14 deletions tests/test_airpyllution.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,7 @@ def json(self):
return "ERROR"
return MockResponse(mock_forecast_data, 200)

return MockResponse(
{
"cod": 401,
"message": mock_invalid_message,
},
404,
)
return MockResponse({"cod": 401, "message": mock_invalid_message,}, 404,)


@patch("requests.get", side_effect=mocked_requests_get_pollution)
Expand Down Expand Up @@ -219,9 +213,7 @@ def test_air_pollution(mock_api_call):
# API error
assert (
airpyllution.get_air_pollution(
mock_params["lat"],
mock_params["lon"],
mock_error_params["appid"],
mock_params["lat"], mock_params["lon"], mock_error_params["appid"],
)
== "An error occurred requesting data from the API"
)
Expand Down Expand Up @@ -311,9 +303,7 @@ def test_pollution_forecast(mock_api_call):

assert (
airpyllution.get_pollution_forecast(
mock_params["lat"],
mock_params["lon"],
mock_error_params["appid"],
mock_params["lat"], mock_params["lon"], mock_error_params["appid"],
)
== "An error occurred requesting data from the API"
)
Expand All @@ -332,7 +322,7 @@ def test_pollution_forecast(mock_api_call):
mock_params["lat"], mock_params["lon"], mock_params["appid"]
)

assert forecast_chart.columns == 4
assert forecast_chart.columns == 3
assert len(forecast_chart.data) > 2
assert len(forecast_chart.data) == 16
assert (
Expand Down

0 comments on commit 14a91d6

Please sign in to comment.