Skip to content

Commit

Permalink
test _find_missing_data
Browse files Browse the repository at this point in the history
  • Loading branch information
docNord committed Apr 24, 2024
1 parent c210bff commit 7cd1bb6
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/unit/test_unit_smhi.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def test_interpolate(
def test_iterate_over_time(
self,
):
"""Unit test for SMHI _interpolate method.
"""Unit test for SMHI _iterate_over_time method.
Args:
"""
Expand Down Expand Up @@ -220,3 +220,29 @@ def test_iterate_over_time(

data = client._iterate_over_time(df, nearby_df, missing_df)
assert data.tail(2).iloc[0]["Temperatur"] == nearby_df.iloc[0]["Temperatur"]

def test_find_missing_data(
self,
):
"""Unit test for SMHI _find_missing_data method.
Args:
"""
df = pd.DataFrame(
{
"date": [
"2024-04-21 10:00",
"2024-04-21 11:00",
"2024-04-21 12:00",
"2024-04-22 12:00",
],
"Temperatur": [1, 1, 1, 12],
}
)
df["date"] = pd.to_datetime(df["date"])
df = df.set_index("date")

client = SMHI()

missingdata = client._find_missing_data(df)
assert missingdata.iloc[0]["Temperatur"] == df.iloc[-1]["Temperatur"]

0 comments on commit 7cd1bb6

Please sign in to comment.