From 734f13318577ad136be45c3e5213000c9eb0f3fa Mon Sep 17 00:00:00 2001 From: Lasse Date: Fri, 23 Feb 2024 13:58:28 +0100 Subject: [PATCH] misc --- src/conftest.py | 1 + src/timeseriesflattener/feature_specs/test_from_legacy.py | 4 ++-- src/timeseriesflattener/testing/load_synth_data.py | 4 +++- src/timeseriesflattener/v1/misc_utils.py | 2 +- .../test_timeseriesflattener/test_flattened_dataset/utils.py | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/conftest.py b/src/conftest.py index 8510e80e..1ca535cb 100644 --- a/src/conftest.py +++ b/src/conftest.py @@ -1,3 +1,4 @@ +"""Fixtures for v1 testing. Delete when v1 is deprecated.""" from __future__ import annotations import pytest diff --git a/src/timeseriesflattener/feature_specs/test_from_legacy.py b/src/timeseriesflattener/feature_specs/test_from_legacy.py index 894e2782..1316699b 100644 --- a/src/timeseriesflattener/feature_specs/test_from_legacy.py +++ b/src/timeseriesflattener/feature_specs/test_from_legacy.py @@ -1,7 +1,7 @@ from __future__ import annotations import pandas as pd -from timeseriesflattener.aggregation_fns import ( +from timeseriesflattener.v1.aggregation_fns import ( boolean, change_per_day, count, @@ -13,7 +13,7 @@ summed, variance, ) -from timeseriesflattener.feature_specs.group_specs import NamedDataframe +from timeseriesflattener.v1.feature_specs.group_specs import NamedDataframe from .from_legacy import PredictorGroupSpec from .predictor import PredictorSpec diff --git a/src/timeseriesflattener/testing/load_synth_data.py b/src/timeseriesflattener/testing/load_synth_data.py index d5e26ffd..c7f26ddf 100644 --- a/src/timeseriesflattener/testing/load_synth_data.py +++ b/src/timeseriesflattener/testing/load_synth_data.py @@ -2,12 +2,14 @@ from __future__ import annotations import logging +from pathlib import Path import polars as pl -from timeseriesflattener.misc_utils import PROJECT_ROOT log = logging.getLogger(__name__) +PROJECT_ROOT = Path(__file__).resolve().parents[3] + TEST_DATA_PATH = PROJECT_ROOT / "src" / "timeseriesflattener" / "testing" / "test_data" diff --git a/src/timeseriesflattener/v1/misc_utils.py b/src/timeseriesflattener/v1/misc_utils.py index 3aa5f25f..49c793d2 100644 --- a/src/timeseriesflattener/v1/misc_utils.py +++ b/src/timeseriesflattener/v1/misc_utils.py @@ -16,7 +16,7 @@ split_dfs: Dict[str, pd.DataFrame] = {} # -PROJECT_ROOT = Path(__file__).resolve().parents[2] +PROJECT_ROOT = Path(__file__).resolve().parents[3] def split_df_and_register_to_dict( diff --git a/src/timeseriesflattener/v1/tests/test_timeseriesflattener/test_flattened_dataset/utils.py b/src/timeseriesflattener/v1/tests/test_timeseriesflattener/test_flattened_dataset/utils.py index 7a45d11d..196207b5 100644 --- a/src/timeseriesflattener/v1/tests/test_timeseriesflattener/test_flattened_dataset/utils.py +++ b/src/timeseriesflattener/v1/tests/test_timeseriesflattener/test_flattened_dataset/utils.py @@ -24,7 +24,7 @@ def check_dfs_have_same_contents_by_column(df1: pd.DataFrame, df2: pd.DataFrame) AssertionError: If the dataframes don't have the same contents by column. """ - cols_to_test = [c for c in df1.columns if "prediction_time_uuid" not in c] + cols_to_test = [c for c in df1.columns if c not in ["prediction_time_uuid", "timestamp"]] for col in cols_to_test: # Saving to csv rounds floats, so we need to round here too