Skip to content

Commit

Permalink
Code style gardening by black
Browse files Browse the repository at this point in the history
  • Loading branch information
douglatornell committed Apr 19, 2024
1 parent 9f3e047 commit ac2aa71
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
6 changes: 3 additions & 3 deletions salishsea_site/views/salishseacast.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,9 +862,9 @@ def _data_for_publish_template(
}
if any(tides_max_ssh_figures_available):
figure_links.append(tides_max_ssh_figure_group.description)
template_data[
"tides_max_ssh_figures_available"
] = tides_max_ssh_figures_available
template_data["tides_max_ssh_figures_available"] = (
tides_max_ssh_figures_available
)
template_data["tides_max_ssh_figures"] = tides_max_ssh_figure_group
return template_data

Expand Down
38 changes: 30 additions & 8 deletions tests/views/test_salishseacast.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ def test_last_date(self, mock_figure_available, mock_now):
(arrow.get("2017-01-06 13:15:42+07:00"), 7, 14),
],
)
def test_month_cols(self, mock_figure_available, now, this_month_cols, last_month_cols, monkeypatch):
def test_month_cols(
self, mock_figure_available, now, this_month_cols, last_month_cols, monkeypatch
):
def mock_now():
return now

Expand Down Expand Up @@ -249,7 +251,14 @@ def test_grid_dates(self, m_exlude_missing_dates, mock_figure_available, mock_no
)
@patch("salishsea_site.views.salishseacast._exclude_missing_dates")
def test_exclude_missing_dates_calls(
self, m_exclude_missing_dates, mock_figure_available, figures, figs_type, run_type, model, mock_now
self,
m_exclude_missing_dates,
mock_figure_available,
figures,
figs_type,
run_type,
model,
mock_now,
):
request = get_current_request()
salishseacast.results_index(request)
Expand Down Expand Up @@ -305,7 +314,9 @@ def test_no_figures_raises_httpnotfound(self, monkeypatch):
def mock_figure_available(self, run_type, run_date):
return False

monkeypatch.setattr(salishseacast.FigureMetadata, "available", mock_figure_available)
monkeypatch.setattr(
salishseacast.FigureMetadata, "available", mock_figure_available
)
request = get_current_request()
with pytest.raises(HTTPNotFound):
salishseacast.nowcast_currents_physics(request)
Expand Down Expand Up @@ -351,7 +362,9 @@ def test_no_figures_raises_httpnotfound(self, monkeypatch):
def mock_img_loop_available(self, run_type, run_date):
return False

monkeypatch.setattr(salishseacast.ImageLoop, "available", mock_img_loop_available)
monkeypatch.setattr(
salishseacast.ImageLoop, "available", mock_img_loop_available
)

request = get_current_request()
request.matchdict = {"results_date": "07may17"}
Expand Down Expand Up @@ -386,19 +399,24 @@ def test_image_loop(self, mock_img_loop_available):
@pytest.mark.usefixtures("pconfig")
class TestTimeseries:
"""Unit tests for nowcast_timeseries view."""

@staticmethod
@pytest.fixture
def mock_fig_group_available(monkeypatch):
def _fig_group_available(*args, **kwargs):
return [True]

monkeypatch.setattr(salishseacast.FigureGroup, "available", _fig_group_available)
monkeypatch.setattr(
salishseacast.FigureGroup, "available", _fig_group_available
)

def test_no_figures_raises_httpnotfound(self, monkeypatch):
def mock_fig_group_available(*args, **kwargs):
return []

monkeypatch.setattr(salishseacast.FigureGroup, "available", mock_fig_group_available)
monkeypatch.setattr(
salishseacast.FigureGroup, "available", mock_fig_group_available
)

request = get_current_request()
request.matchdict = {"results_date": "27jun17"}
Expand Down Expand Up @@ -438,7 +456,9 @@ def test_no_figures_raises_httpnotfound(self, monkeypatch):
def mock_figure_available(*args, **kwargs):
return False

monkeypatch.setattr(salishseacast.FigureMetadata, "available", mock_figure_available)
monkeypatch.setattr(
salishseacast.FigureMetadata, "available", mock_figure_available
)
request = get_current_request()
with pytest.raises(HTTPNotFound):
salishseacast.nowcast_comparison(request)
Expand Down Expand Up @@ -491,7 +511,9 @@ def test_no_alerts_fig_raises_httpnotfound(self, monkeypatch):
def mock_figure_available(self, run_type, run_date):
return False

monkeypatch.setattr(salishseacast.FigureMetadata, "available", mock_figure_available)
monkeypatch.setattr(
salishseacast.FigureMetadata, "available", mock_figure_available
)
request = get_current_request()
with pytest.raises(HTTPNotFound):
salishseacast._data_for_publish_template(
Expand Down

0 comments on commit ac2aa71

Please sign in to comment.