Skip to content
Snippets Groups Projects
Commit 43dbbb95 authored by lukas leufen's avatar lukas leufen
Browse files

fixed test

parent 77e6b8da
No related branches found
No related tags found
3 merge requests!90WIP: new release update,!89Resolve "release branch / CI on gpu",!61Resolve "REFAC: clean-up bootstrap workflow"
......@@ -125,11 +125,12 @@ class PreProcessing(RunEnvironment):
:param kwargs: positional parameters for the DataGenerator class (e.g. `start`, `interpolate_method`,
`window_lead_time`).
:param all_stations: All stations to check.
:param name: name to display in the logging info message
:return: Corrected list containing only valid station IDs.
"""
t_outer = TimeTracking()
t_inner = TimeTracking(start=False)
logging.info(f"check valid stations started{' (%s)' % name if name else name}")
logging.info(f"check valid stations started{' (%s)' % name if name else ''}")
valid_stations = []
# all required arguments of the DataGenerator can be found in args, positional arguments in args and kwargs
......
......@@ -81,16 +81,18 @@ class TestPreProcessing:
data_store.get("generator", "general")
assert data_store.get("stations", "general.awesome") == ['DEBW107', 'DEBY081', 'DEBW013', 'DEBW076', 'DEBW087']
def test_check_valid_stations(self, caplog, obj_with_exp_setup):
@pytest.mark.parametrize("name", (None, "tester"))
def test_check_valid_stations(self, caplog, obj_with_exp_setup, name):
pre = obj_with_exp_setup
caplog.set_level(logging.INFO)
args = pre.data_store.create_args_dict(DEFAULT_ARGS_LIST)
kwargs = pre.data_store.create_args_dict(DEFAULT_KWARGS_LIST)
stations = pre.data_store.get("stations", "general")
valid_stations = pre.check_valid_stations(args, kwargs, stations)
valid_stations = pre.check_valid_stations(args, kwargs, stations, name=name)
assert len(valid_stations) < len(stations)
assert valid_stations == stations[:-1]
assert caplog.record_tuples[0] == ('root', 20, 'check valid stations started')
expected = 'check valid stations started (tester)' if name else 'check valid stations started'
assert caplog.record_tuples[0] == ('root', 20, expected)
assert caplog.record_tuples[-1] == ('root', 20, PyTestRegex(r'run for \d+:\d+:\d+ \(hh:mm:ss\) to check 6 '
r'station\(s\). Found 5/6 valid stations.'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment