Skip to content

Commit

Permalink
rename the old TestMeteo to TestExtModel
Browse files Browse the repository at this point in the history
  • Loading branch information
MAfarrag committed Nov 17, 2024
1 parent 77a4f78 commit a3b335b
Showing 1 changed file with 51 additions and 50 deletions.
101 changes: 51 additions & 50 deletions tests/dflowfm/test_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,65 +598,66 @@ def test_given_dict_values_doesnot_raise(self, dict_values: dict):
== expected_locationfile
)

class TestMeteo:
"""Class to test all methods contained in the
hydrolib.core.dflowfm.ext.models.Meteo class"""

def test_construct_from_file_with_tim(self):
input_ext = (
test_input_dir
/ "e02/f006_external_forcing/c063_rain_tim/rainschematic.ext"
)
class TestExtModel:
"""Class to test all methods contained in the
hydrolib.core.dflowfm.ext.models.ExtModel class"""

ext_model = ExtModel(input_ext)
def test_construct_from_file_with_tim(self):
input_ext = (
test_input_dir
/ "e02/f006_external_forcing/c063_rain_tim/rainschematic.ext"
)

assert isinstance(ext_model, ExtModel)
assert len(ext_model.meteo) == 1
assert ext_model.meteo[0].quantity == "rainfall_rate"
assert isinstance(ext_model.meteo[0].forcingfile, TimModel)
assert ext_model.meteo[0].forcingfiletype == MeteoForcingFileType.uniform
ext_model = ExtModel(input_ext)

assert len(ext_model.meteo[0].forcingfile.timeseries) == 14
assert isinstance(ext_model, ExtModel)
assert len(ext_model.meteo) == 1
assert ext_model.meteo[0].quantity == "rainfall_rate"
assert isinstance(ext_model.meteo[0].forcingfile, TimModel)
assert ext_model.meteo[0].forcingfiletype == MeteoForcingFileType.uniform

def test_construct_from_file_with_bc(self):
input_ext = (
test_input_dir
/ "e02/f006_external_forcing/c069_rain_bc/rainschematic.ext"
)
assert len(ext_model.meteo[0].forcingfile.timeseries) == 14

ext_model = ExtModel(input_ext)
def test_construct_from_file_with_bc(self):
input_ext = (
test_input_dir
/ "e02/f006_external_forcing/c069_rain_bc/rainschematic.ext"
)

assert isinstance(ext_model, ExtModel)
assert len(ext_model.meteo) == 1
assert ext_model.meteo[0].quantity == "rainfall_rate"
assert isinstance(ext_model.meteo[0].forcingfile, ForcingModel)
assert ext_model.meteo[0].forcingfiletype == MeteoForcingFileType.bcascii
ext_model = ExtModel(input_ext)

def test_construct_from_file_with_netcdf(self):
input_ext = (
test_input_dir
/ "e02/f006_external_forcing/c067_rain_netcdf_stations/rainschematic.ext"
)
assert isinstance(ext_model, ExtModel)
assert len(ext_model.meteo) == 1
assert ext_model.meteo[0].quantity == "rainfall_rate"
assert isinstance(ext_model.meteo[0].forcingfile, ForcingModel)
assert ext_model.meteo[0].forcingfiletype == MeteoForcingFileType.bcascii

def test_construct_from_file_with_netcdf(self):
input_ext = (
test_input_dir
/ "e02/f006_external_forcing/c067_rain_netcdf_stations/rainschematic.ext"
)

ext_model = ExtModel(input_ext)

assert isinstance(ext_model, ExtModel)
assert len(ext_model.meteo) == 1
assert ext_model.meteo[0].quantity == "rainfall"
assert isinstance(ext_model.meteo[0].forcingfile, DiskOnlyFileModel)
assert ext_model.meteo[0].forcingfiletype == MeteoForcingFileType.netcdf


def test_ext_model_correct_default_serializer_config(self):
model = ExtModel()

ext_model = ExtModel(input_ext)

assert isinstance(ext_model, ExtModel)
assert len(ext_model.meteo) == 1
assert ext_model.meteo[0].quantity == "rainfall"
assert isinstance(ext_model.meteo[0].forcingfile, DiskOnlyFileModel)
assert ext_model.meteo[0].forcingfiletype == MeteoForcingFileType.netcdf

class TestExtModel:
def test_ext_model_correct_default_serializer_config(self):
model = ExtModel()

assert model.serializer_config.section_indent == 0
assert model.serializer_config.property_indent == 0
assert model.serializer_config.datablock_indent == 8
assert model.serializer_config.float_format == ""
assert model.serializer_config.datablock_spacing == 2
assert model.serializer_config.comment_delimiter == "#"
assert model.serializer_config.skip_empty_properties == True
assert model.serializer_config.section_indent == 0
assert model.serializer_config.property_indent == 0
assert model.serializer_config.datablock_indent == 8
assert model.serializer_config.float_format == ""
assert model.serializer_config.datablock_spacing == 2
assert model.serializer_config.comment_delimiter == "#"
assert model.serializer_config.skip_empty_properties == True


class TestInitialConditions:
Expand Down

0 comments on commit a3b335b

Please sign in to comment.