Skip to content

Commit c231f1b

Browse files
committed
merge changes from remote
2 parents 1b372cd + 7ec7450 commit c231f1b

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

tests/dflowfm/bc/test_forcing_model.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
23
import numpy as np
34
import pytest
45
from pydantic.v1.error_wrappers import ValidationError
@@ -15,7 +16,7 @@
1516
QHTable,
1617
QuantityUnitPair,
1718
TimeInterpolation,
18-
TimeSeries
19+
TimeSeries,
1920
)
2021
from tests.utils import assert_files_equal
2122

@@ -27,6 +28,7 @@ def quantityunitpair(quantity, unit, verticalpositionindex=None):
2728
quantity=quantity, unit=unit, vertpositionindex=verticalpositionindex
2829
)
2930

31+
3032
def harmonic_values(iscorrection: bool):
3133
function = "harmonic-correction" if iscorrection else "harmonic"
3234
return dict(
@@ -43,6 +45,7 @@ def harmonic_values(iscorrection: bool):
4345
],
4446
)
4547

48+
4649
def qhtable_values():
4750
return dict(
4851
name="boundary_qhtable",
@@ -73,6 +76,7 @@ def constant_values():
7376
],
7477
)
7578

79+
7680
def astronomic_values(iscorrection: bool, quantityunitpair):
7781
function = "astronomic-correction" if iscorrection else "astronomic"
7882
return dict(
@@ -120,7 +124,7 @@ def test_parses_function_case_insensitive(self, input, expected):
120124
],
121125
)
122126
def test_create_forcingbase_missing_field_raises_correct_error(
123-
self, missing_field: str
127+
self, missing_field: str
124128
):
125129
values = dict(
126130
name="Boundary2",
@@ -143,13 +147,13 @@ def test_create_forcingbase_missing_field_raises_correct_error(
143147
[
144148
(["time", "dischargebnd"], "m³/s"),
145149
(
146-
["time", "dischargebnd", "extra"],
147-
["minutes since 2021-01-01 00:00:00", "m³/s"],
150+
["time", "dischargebnd", "extra"],
151+
["minutes since 2021-01-01 00:00:00", "m³/s"],
148152
),
149153
],
150154
)
151155
def test_create_forcingbase_mismatch_number_of_quantities_units_raises_correct_error(
152-
self, quantities, units
156+
self, quantities, units
153157
):
154158
values = dict(
155159
name="Boundary2",
@@ -172,7 +176,10 @@ class TestForcingModel:
172176
"""
173177

174178
def test_forcing_model(self, input_files_dir):
175-
filepath = input_files_dir / "e02/f101_1D-boundaries/c01_steady-state-flow/BoundaryConditions.bc"
179+
filepath = (
180+
input_files_dir
181+
/ "e02/f101_1D-boundaries/c01_steady-state-flow/BoundaryConditions.bc"
182+
)
176183

177184
m = ForcingModel(filepath)
178185
assert len(m.forcing) == 13
@@ -192,7 +199,9 @@ def test_read_bc_missing_field_raises_correct_error(self, invalid_data_dir):
192199
assert expected_message1 in str(error.value)
193200
assert expected_message2 in str(error.value)
194201

195-
def test_save_forcing_model(self, time_series_values, t3d_values, output_files_dir, reference_files_dir):
202+
def test_save_forcing_model(
203+
self, time_series_values, t3d_values, output_files_dir, reference_files_dir
204+
):
196205
bc_file = output_files_dir / TEST_BC_FILE
197206
reference_file = reference_files_dir / "bc" / TEST_BC_FILE
198207
forcingmodel = ForcingModel()
@@ -221,7 +230,7 @@ def test_save_forcing_model(self, time_series_values, t3d_values, output_files_d
221230

222231
@pytest.mark.parametrize("cls", [Astronomic, AstronomicCorrection])
223232
def test_astronomic_values_with_strings_in_datablock_are_parsed_correctly(
224-
self, cls
233+
self, cls
225234
):
226235
try:
227236
is_correction = cls == AstronomicCorrection
@@ -280,4 +289,4 @@ def test_forcing_model_with_datablock_that_has_nan_values_should_raise_error(sel
280289
)
281290

282291
expected_message = "NaN is not supported in datablocks."
283-
assert expected_message in str(error.value)
292+
assert expected_message in str(error.value)

0 commit comments

Comments
 (0)