@@ -273,7 +273,8 @@ def _get_resample_from_period(period: str) -> str:
|
|||||||
if period == 'day':
|
if period == 'day':
|
||||||
return '1d'
|
return '1d'
|
||||||
if period == 'week':
|
if period == 'week':
|
||||||
return '1w'
|
# Weekly defaulting to Monday.
|
||||||
|
return '1W-MON'
|
||||||
if period == 'month':
|
if period == 'month':
|
||||||
return '1M'
|
return '1M'
|
||||||
raise ValueError(f"Period {period} is not supported.")
|
raise ValueError(f"Period {period} is not supported.")
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ def test_generate_periodic_breakdown_stats(testdatadir):
|
|||||||
def test__get_resample_from_period():
|
def test__get_resample_from_period():
|
||||||
|
|
||||||
assert _get_resample_from_period('day') == '1d'
|
assert _get_resample_from_period('day') == '1d'
|
||||||
assert _get_resample_from_period('week') == '1w'
|
assert _get_resample_from_period('week') == '1W-MON'
|
||||||
assert _get_resample_from_period('month') == '1M'
|
assert _get_resample_from_period('month') == '1M'
|
||||||
with pytest.raises(ValueError, match=r"Period noooo is not supported."):
|
with pytest.raises(ValueError, match=r"Period noooo is not supported."):
|
||||||
_get_resample_from_period('noooo')
|
_get_resample_from_period('noooo')
|
||||||
|
|||||||
Reference in New Issue
Block a user