diff --git a/test/test_data_handling/test_data_generator.py b/test/test_data_handling/test_data_generator.py index ad112549d833e0fda9eae3c238b106d4b0215e79..142acd166604951352ad6686548c2cb76f609ce0 100644 --- a/test/test_data_handling/test_data_generator.py +++ b/test/test_data_handling/test_data_generator.py @@ -20,7 +20,7 @@ class TestDataGenerator: @pytest.fixture def gen(self): return DataGenerator(os.path.join(os.path.dirname(__file__), 'data'), 'AIRBASE', 'DEBW107', ['o3', 'temp'], - 'datetime', 'variables', 'o3') + 'datetime', 'variables', 'o3', start=2010, end=2014) class DummyDataPrep: def __init__(self, data): @@ -42,13 +42,14 @@ class TestDataGenerator: assert gen.window_history_size == 7 assert gen.window_lead_time == 4 assert gen.transform_method == "standardise" - assert gen.kwargs == {} + assert gen.kwargs == {"start": 2010, "end": 2014} def test_repr(self, gen): path = os.path.join(os.path.dirname(__file__), 'data') assert gen.__repr__().rstrip() == f"DataGenerator(path='{path}', network='AIRBASE', stations=['DEBW107'], "\ f"variables=['o3', 'temp'], station_type=None, interpolate_dim='datetime', " \ - f"target_dim='variables', target_var='o3', **{{}})".rstrip() + f"target_dim='variables', target_var='o3', **{{'start': 2010, 'end': 2014}})"\ + .rstrip() def test_len(self, gen): assert len(gen) == 1 @@ -99,7 +100,7 @@ class TestDataGenerator: def test_get_data_generator(self, gen): gen.kwargs = {"statistics_per_var": {'o3': 'dma8eu', 'temp': 'maximum'}} - file = os.path.join(gen.data_path_tmp, f"DEBW107_{'_'.join(sorted(gen.variables))}.pickle") + file = os.path.join(gen.data_path_tmp, f"DEBW107_{'_'.join(sorted(gen.variables))}_None_None_.pickle") if os.path.exists(file): os.remove(file) assert not os.path.exists(file) @@ -113,7 +114,7 @@ class TestDataGenerator: assert os.stat(file).st_ctime > t def test_save_pickle_data(self, gen): - file = os.path.join(gen.data_path_tmp, f"DEBW107_{'_'.join(sorted(gen.variables))}.pickle") + file = os.path.join(gen.data_path_tmp, f"DEBW107_{'_'.join(sorted(gen.variables))}_2010_2014_.pickle") if os.path.exists(file): os.remove(file) assert not os.path.exists(file) @@ -123,7 +124,7 @@ class TestDataGenerator: os.remove(file) def test_load_pickle_data(self, gen): - file = os.path.join(gen.data_path_tmp, f"DEBW107_{'_'.join(sorted(gen.variables))}.pickle") + file = os.path.join(gen.data_path_tmp, f"DEBW107_{'_'.join(sorted(gen.variables))}_2010_2014_.pickle") data = self.DummyDataPrep(np.ones((10, 2))) with open(file, "wb") as f: pickle.dump(data, f) diff --git a/test/test_data_handling/test_data_preparation.py b/test/test_data_handling/test_data_preparation.py index fd33cea96af5131e34ca17ae8c95bef9266f796e..72bacaf9cc1e5a9dc9736b8e8eb7161f35d8ea69 100644 --- a/test/test_data_handling/test_data_preparation.py +++ b/test/test_data_handling/test_data_preparation.py @@ -28,6 +28,7 @@ class TestDataPrep: d.station = ['DEBW107'] d.variables = ['o3', 'temp'] d.station_type = "background" + d.sampling = "daily" d.kwargs = None return d