Skip to content
Snippets Groups Projects
Commit c0437e65 authored by Niklas Selke's avatar Niklas Selke
Browse files

Merge branch 'niklas_issue005_refac_refactor-and-expand-testing' into 'develop'

Modified the test for the 'value_count' statistic. Now all available sampling...

See merge request !4
parents 48a82c84 a3ab7cfc
Branches
Tags
2 merge requests!5Modified the test for the 'value_count' statistic. Now all available sampling...,!4Modified the test for the 'value_count' statistic. Now all available sampling...
[pytest]
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
This diff is collapsed.
import numpy as np
import pandas as pd
from toarstats.interface import calculate_statistics
class TestCalculateStatistics:
def test_calculate_statistics_simple_input(self):
data = pd.DataFrame(
range(10), index=pd.date_range(start="2000", periods=10, freq="H")
)
result = calculate_statistics("daily", "average_values", data)
expected_result = pd.DataFrame(
{"mean": 4.5}, index=pd.DatetimeIndex(["2000"], freq="D")
)
pd.testing.assert_frame_equal(result, expected_result)
def test_calculate_statistics_different_data_capture(self):
data = pd.DataFrame(
[1, 2, np.nan, 4, 5, np.nan, 7, np.nan, np.nan, np.nan],
index=pd.date_range(start="2000", periods=10, freq="H")
)
result = calculate_statistics("daily", "average_values", data,
data_capture=0.75)
expected_result = pd.DataFrame(
{"mean": np.nan}, index=pd.DatetimeIndex(["2000"], freq="D")
)
pd.testing.assert_frame_equal(result, expected_result)
data = pd.DataFrame(
range(24),
index=pd.date_range(start="2000", periods=24, freq="H")
)
result = calculate_statistics("daily", "diurnal_cycle", data)
expected_result = pd.DataFrame(
{"diurnal_cycle": [float(num) for num in range(24)]},
index=pd.date_range(start="2000", periods=24, freq="H")
)
pd.testing.assert_frame_equal(result, expected_result)
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment