Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_base_processing(self):
"text__°C__meteo": np.random.randn(24),
"hr__%hr__meteo": np.random.randn(24),
},
index=pd.date_range("2024-12-05 00:00:00", freq="h", periods=24),
index=pd.date_range("2024-12-05 00:00:00", freq="h", periods=24, tz="UTC"),
)

dp = DumbProcessor(required_columns=["text__°C__meteo"], keep_required=False)
Expand Down
20 changes: 12 additions & 8 deletions tests/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ def test_time_gradient(self):
test = (
pd.Series(
[0, 1, 2, 2, 2, 3],
index=pd.date_range("2009-01-01 00:00:00", freq="10s", periods=6),
index=pd.date_range(
"2009-01-01 00:00:00", freq="10s", periods=6, tz="UTC"
),
name="cpt1",
)
* 3600
)

ref = pd.DataFrame(
{"cpt1": [360.0, 360.0, 180.0, -5.68e-14, 180.0, 360.0]},
index=pd.date_range("2009-01-01 00:00:00", freq="10s", periods=6),
index=pd.date_range("2009-01-01 00:00:00", freq="10s", periods=6, tz="UTC"),
)

to_test = time_gradient(test)
Expand All @@ -26,7 +28,9 @@ def test_time_gradient(self):
test = (
pd.DataFrame(
{"cpt1": [0, 1, 2, 2, 2, 3], "cpt2": [0, 1, 2, 2, 2, 3]},
index=pd.date_range("2009-01-01 00:00:00", freq="10s", periods=6),
index=pd.date_range(
"2009-01-01 00:00:00", freq="10s", periods=6, tz="UTC"
),
)
* 3600
)
Expand All @@ -36,7 +40,7 @@ def test_time_gradient(self):
"cpt1": [360.0, 360.0, 180.0, -5.68e-14, 180.0, 360.0],
"cpt2": [360.0, 360.0, 180.0, -5.68e-14, 180.0, 360.0],
},
index=pd.date_range("2009-01-01 00:00:00", freq="10s", periods=6),
index=pd.date_range("2009-01-01 00:00:00", freq="10s", periods=6, tz="UTC"),
)

to_test = time_gradient(test)
Expand All @@ -46,7 +50,7 @@ def test_time_gradient(self):
def test_time_integrate(self):
test = pd.Series(
[360.0, 360.0, 180.0, -5.68e-14, 180.0, 360.0],
index=pd.date_range("2009-01-01 00:00:00", freq="10s", periods=6),
index=pd.date_range("2009-01-01 00:00:00", freq="10s", periods=6, tz="UTC"),
name="cpt",
)

Expand All @@ -59,7 +63,7 @@ def test_time_integrate(self):
"cpt1": [360.0, 360.0, 180.0, -5.68e-14, 180.0, 360.0],
"cpt2": [360.0, 360.0, 180.0, -5.68e-14, 180.0, 360.0],
},
index=pd.date_range("2009-01-01 00:00:00", freq="10s", periods=6),
index=pd.date_range("2009-01-01 00:00:00", freq="10s", periods=6, tz="UTC"),
)

ref = pd.Series({"cpt1": 3.0, "cpt2": 3.0})
Expand All @@ -69,11 +73,11 @@ def test_time_integrate(self):
def test_aggregate_time_series(self):
sim_res = pd.DataFrame(
{"a": [1, 2], "b": [3, 4]},
index=pd.date_range("2009-01-01", freq="h", periods=2),
index=pd.date_range("2009-01-01", freq="h", periods=2, tz="UTC"),
)
ref_df = pd.DataFrame(
{"a": [1, 1], "b": [3, 4]},
index=pd.date_range("2009-01-01", freq="h", periods=2),
index=pd.date_range("2009-01-01", freq="h", periods=2, tz="UTC"),
)

expected_default = pd.Series([1.5, 3.5], index=["a", "b"])
Expand Down
24 changes: 11 additions & 13 deletions tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_plot_gaps_heatmap(self):
"a": np.random.randn(24),
"b": np.random.randn(24),
},
index=pd.date_range("2009", freq="h", periods=24),
index=pd.date_range("2009", freq="h", periods=24, tz="UTC"),
)

df.loc["2009-01-01 05:00:00":"2009-01-01 09:00:00", :] = np.nan
Expand All @@ -71,7 +71,7 @@ def test_add_multi_axis_scatter(self):
"b__W": np.random.randn(24) * 100,
"e__Wh": np.random.randn(24) * 100,
},
index=pd.date_range("2009", freq="h", periods=24),
index=pd.date_range("2009", freq="h", periods=24, tz="UTC"),
)
df["e__Wh"] = abs(df).cumsum()["e__Wh"]

Expand All @@ -94,14 +94,12 @@ def test_add_multi_axis_scatter(self):
y_title_standoff=1,
)

assert True

def test_get_gaps_scatter_dict(self):
np.random.seed(42)
measure = pd.Series(
np.random.randn(24),
name="name",
index=pd.date_range("2009", freq="h", periods=24),
index=pd.date_range("2009", freq="h", periods=24, tz="UTC"),
)

measure.loc["2009-01-01 02:00:00":"2009-01-01 05:00:00"] = np.nan
Expand All @@ -114,10 +112,10 @@ def test_get_gaps_scatter_dict(self):
assert gap_dict == [
{
"x": [
pd.Timestamp("2009-01-01 01:00:00"),
pd.Timestamp("2009-01-01 01:00:00"),
pd.Timestamp("2009-01-01 06:00:00"),
pd.Timestamp("2009-01-01 06:00:00"),
pd.Timestamp("2009-01-01 01:00:00", tz="UTC"),
pd.Timestamp("2009-01-01 01:00:00", tz="UTC"),
pd.Timestamp("2009-01-01 06:00:00", tz="UTC"),
pd.Timestamp("2009-01-01 06:00:00", tz="UTC"),
],
"y": [
-1.913280244657798,
Expand All @@ -133,10 +131,10 @@ def test_get_gaps_scatter_dict(self):
},
{
"x": [
pd.Timestamp("2009-01-01 11:00:00"),
pd.Timestamp("2009-01-01 11:00:00"),
pd.Timestamp("2009-01-01 13:00:00"),
pd.Timestamp("2009-01-01 13:00:00"),
pd.Timestamp("2009-01-01 11:00:00", tz="UTC"),
pd.Timestamp("2009-01-01 11:00:00", tz="UTC"),
pd.Timestamp("2009-01-01 13:00:00", tz="UTC"),
pd.Timestamp("2009-01-01 13:00:00", tz="UTC"),
],
"y": [
-1.913280244657798,
Expand Down
9 changes: 6 additions & 3 deletions tests/test_plumbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"light__DIMENSIONLESS__building": [100, 200, 300],
"mass_flwr__m3/h__hvac": [300, 500, 600],
},
index=pd.date_range("2009", freq="h", periods=3),
index=pd.date_range("2009", freq="h", periods=3, tz="UTC"),
)

TEST_DF_2 = pd.DataFrame(
Expand All @@ -33,7 +33,7 @@
"b__°C__zone_1": np.random.randn(24),
"c__Wh__zone_2": np.random.randn(24) * 100,
},
index=pd.date_range("2009", freq="h", periods=24),
index=pd.date_range("2009", freq="h", periods=24, tz="UTC"),
)

TEST_DF_2["c__Wh__zone_2"] = abs(TEST_DF_2).cumsum()["c__Wh__zone_2"]
Expand Down Expand Up @@ -73,7 +73,7 @@ def test__get_all_data_step(self):
test_df = TEST_DF.copy()
test_df.iloc[1, 0] = np.nan
test_df.iloc[0, 1] = np.nan
pipe = _get_pipe_from_proc_list(test_df.columns, PIPE_DICT["common"])
pipe = _get_pipe_from_proc_list(test_df.columns, PIPE_DICT["common"], tz="UTC")

res = pipe.fit_transform(test_df)

Expand All @@ -86,6 +86,7 @@ def test__get_column_wise_transformer(self):
col_trans = _get_column_wise_transformer(
proc_dict=PIPE_DICT["pre_processing"],
data_columns=TEST_DF.columns,
tz="UTC",
process_name="test",
)

Expand All @@ -99,6 +100,7 @@ def test__get_column_wise_transformer(self):
data_columns=TEST_DF[
[col for col in TEST_DF.columns if col != "radiation__W/m2__outdoor"]
].columns,
tz="UTC",
process_name="test",
)

Expand All @@ -122,6 +124,7 @@ def test__get_column_wise_transformer(self):
col_trans = _get_column_wise_transformer(
proc_dict=PIPE_DICT["pre_processing"],
data_columns=cols_none,
tz="UTC",
process_name="test",
)

Expand Down
Loading
Loading