Skip to content

Commit a2339a0

Browse files
committed
a few test fixes
1 parent 4e1f636 commit a2339a0

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

tests/test_aggregation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ def test_seasonal_trend_test_aggregation_methods():
3232
# ensuring the aggregation logic executes correctly, not with a
3333
# specific trend outcome, which may be statistically weak.
3434
assert result is not None
35-
assert result.trend in ['increasing', 'decreasing', 'no trend']
35+
assert result.trend in ['increasing', 'decreasing', 'no trend', 'indeterminate']
3636
assert isinstance(result.h, (bool, np.bool_))
3737
assert not np.isnan(result.p) if result.h else True

tests/test_censored_data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_hicensor_rule_trend_test():
8181
# The data effectively becomes ['<10', '<10', '<10', '<10', '<10', '<10']
8282
# This should result in no trend.
8383
result_hicensor = trend_test(x=data, t=t, hicensor=True)
84-
assert result_hicensor.trend == 'no trend'
84+
assert result_hicensor.trend == 'indeterminate'
8585
assert 'No Trend' in result_hicensor.classification or 'As Likely as Not' in result_hicensor.classification
8686
assert abs(result_hicensor.s) <= abs(result_no_hicensor.s)
8787

@@ -118,7 +118,7 @@ def test_hicensor_rule_seasonal_trend_test():
118118
# The hicensor rule correctly weakens the trend to "no trend" in this case,
119119
# as the Mann-Kendall score `s` becomes 1, which results in a z-score of 0
120120
# after the continuity correction.
121-
assert result_hicensor.trend == 'no trend'
121+
assert result_hicensor.trend == 'indeterminate'
122122
# 'No Trend' classification is generally gone, replaced by 'As Likely as Not'
123123
assert 'As Likely as Not' in result_hicensor.classification or result_hicensor.classification == 'No Trend'
124124
# The absolute s-score should be less than the original, demonstrating
@@ -161,7 +161,7 @@ def test_hicensor_numeric_seasonal_trend_test():
161161
# The July data [20, 22] has an increasing trend, but the overall
162162
# result is weakened by the tied January data.
163163
result_hicensor_8 = seasonal_trend_test(x=data, t=t, period=12, hicensor=8)
164-
assert result_hicensor_8.trend == 'no trend'
164+
assert result_hicensor_8.trend == 'indeterminate'
165165

166166
def test_mk_test_method_lwp():
167167
"""Test the 'lwp' method for the Mann-Kendall test."""

tests/test_continuous_confidence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@ def test_exact_zero_trend():
105105
res = trend_test(x, t, continuous_confidence=True)
106106
assert res.s == 0
107107
assert res.z == 0
108-
assert res.trend == 'no trend'
108+
assert res.trend == 'indeterminate'
109109
# Default map for 0.5 confidence (which C is when p=1.0) is "As Likely as Not"
110110
assert "As Likely as Not" in res.classification

tests/test_datetime_coverage.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def test_get_season_func_various_types(season_type, period, date_str, expected_s
2121
_get_season_func(season_type, period)
2222
else:
2323
func = _get_season_func(season_type, period)
24-
assert func(dates)[0] == expected_season
24+
result = func(dates)
25+
val = result.iloc[0] if isinstance(result, pd.Series) else result[0]
26+
assert val == expected_season
2527

2628
# --- Tests for _get_agg_func ---
2729

@@ -42,4 +44,6 @@ def test_get_agg_func_various_periods(agg_period, date_str, expected_group):
4244
_get_agg_func(agg_period)
4345
else:
4446
func = _get_agg_func(agg_period)
45-
assert func(dates)[0] == expected_group
47+
result = func(dates)
48+
val = result.iloc[0] if isinstance(result, pd.Series) else result[0]
49+
assert val == expected_group

tests/test_median_thinning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_median_thinning_logic():
3131

3232
# The Mann-Kendall score for 2 points [5.5, 17.5] is +1
3333
assert result.s == 1
34-
assert result.trend == 'no trend' # Sample size 2 is small, h might be False
34+
assert result.trend == 'indeterminate' # Sample size 2 is small, h might be False
3535

3636
# To check the actual values, we might need to debug or rely on 's'.
3737
# If aggregation worked, n should be 2.

tests/test_seasonality_and_plotting.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ def test_plot_seasonal_distribution(seasonal_data):
4444
if os.path.exists(plot_path):
4545
os.remove(plot_path)
4646

47-
returned_path = plot_seasonal_distribution(x, t, plot_path=plot_path)
47+
with pytest.warns(PendingDeprecationWarning, match="vert: bool"):
48+
returned_path = plot_seasonal_distribution(x, t, plot_path=plot_path)
4849

4950
assert returned_path == plot_path
5051
assert os.path.exists(plot_path)

tests/test_stats_coverage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_zero_variance_handling():
2121
# The primary assertions are on the final, user-facing results.
2222
# The intermediate var_s value is a non-critical implementation detail
2323
# in this specific edge case because s=0.
24-
assert result.trend == 'no trend'
24+
assert result.trend == 'indeterminate'
2525
assert not result.h # Use truthiness for numpy.bool_
2626
assert result.s == 0
2727
assert result.p == 1.0

0 commit comments

Comments
 (0)