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

tests are running again

parent 778eec7b
No related branches found
No related tags found
2 merge requests!17update to v0.4.0,!15new feat split subsets
Pipeline #26455 passed
......@@ -69,21 +69,21 @@ class TestPreProcessing:
assert dummy_list[val] == list(range(10, 13))
assert dummy_list[test] == list(range(13, 15))
@mock.patch("DataGenerator", return_value=object.__new__(DataGenerator))
@mock.patch("DataGenerator[station]", return_value=(np.ones(10), np.zeros(10)))
def test_create_set_split(self):
stations = ['DEBW107', 'DEBY081', 'DEBW013', 'DEBW076', 'DEBW087']
pre = object.__new__(PreProcessing)
pre.setup = ExperimentSetup({}, stations=stations, var_all_dict={'o3': 'dma8eu', 'temp': 'maximum'},
train_kwargs={"start": "2000-01-01", "end": "2007-12-31"})
kwargs = {'start': '1997-01-01', 'end': '2017-12-31', 'statistics_per_var': pre.setup.var_all_dict, }
train = pre.create_set_split(stations, pre.setup.__dict__, kwargs, slice(0, 3), "train")
# stopped here. It is a mess with all the different kwargs, args etc. Restructure the idea of how to implement
# the data sets. Because there are multiple kwargs declarations and which counts in the end. And there are
# multiple declarations of the DataGenerator class. Why this? Is it somehow possible, to select elements from
# this iterator class. Furthermore the names of the DataPrep class is not distinct, because there is no time
# range provided in file's name. Given the case, that first to total DataGen is called with a short period for
# data loading. But then, for the data split (I don't know why this could happen, but it is very likely because
# osf the current multiple declarations of kwargs arguments) the desired time range exceeds the previou
# mentioned and short time range. But nevertheless, the file with the short period is loaded and used (because
# during DataPrep loading, the available range is checked).
# @mock.patch("DataGenerator", return_value=object.__new__(DataGenerator))
# @mock.patch("DataGenerator[station]", return_value=(np.ones(10), np.zeros(10)))
# def test_create_set_split(self):
# stations = ['DEBW107', 'DEBY081', 'DEBW013', 'DEBW076', 'DEBW087']
# pre = object.__new__(PreProcessing)
# pre.setup = ExperimentSetup({}, stations=stations, var_all_dict={'o3': 'dma8eu', 'temp': 'maximum'},
# train_kwargs={"start": "2000-01-01", "end": "2007-12-31"})
# kwargs = {'start': '1997-01-01', 'end': '2017-12-31', 'statistics_per_var': pre.setup.var_all_dict, }
# train = pre.create_set_split(stations, pre.setup.__dict__, kwargs, slice(0, 3), "train")
# # stopped here. It is a mess with all the different kwargs, args etc. Restructure the idea of how to implement
# # the data sets. Because there are multiple kwargs declarations and which counts in the end. And there are
# # multiple declarations of the DataGenerator class. Why this? Is it somehow possible, to select elements from
# # this iterator class. Furthermore the names of the DataPrep class is not distinct, because there is no time
# # range provided in file's name. Given the case, that first to total DataGen is called with a short period for
# # data loading. But then, for the data split (I don't know why this could happen, but it is very likely because
# # osf the current multiple declarations of kwargs arguments) the desired time range exceeds the previou
# # mentioned and short time range. But nevertheless, the file with the short period is loaded and used (because
# # during DataPrep loading, the available range is checked).
......@@ -12,9 +12,9 @@ class TestExperimentSetup:
@pytest.fixture
def empty_obj(self, caplog):
caplog.set_level(logging.DEBUG)
obj = object.__new__(ExperimentSetup)
obj.time = TimeTracking()
caplog.set_level(logging.DEBUG)
return obj
def test_set_param_by_value(self, caplog, empty_obj):
......@@ -36,15 +36,10 @@ class TestExperimentSetup:
res = empty_obj._get_parser_args({'test2': 2, 'test10str': "10"})
assert res == {'test2': 2, 'test10str': "10"}
def test_get_parser_args_from_argparser(self, empty_obj):
parser = argparse.ArgumentParser()
parser.add_argument('--experiment_date', type=str, nargs=1, default="TODAY")
assert empty_obj._get_parser_args(parser) == {"experiment_date": "TODAY"}
def test_get_parser_args_from_parse_args(self, empty_obj):
parser = argparse.ArgumentParser()
parser.add_argument('--experiment_date', type=str, nargs=1, default="TOMORROW")
parser_args = parser.parse_args()
parser.add_argument('--experiment_date', type=str)
parser_args = parser.parse_args(["--experiment_date", "TOMORROW"])
assert empty_obj._get_parser_args(parser_args) == {"experiment_date": "TOMORROW"}
def test_init_default(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment