Upload hf_env/lib/python3.14/site-packages/pandas/tests/indexes/period/test_freq_attr.py with huggingface_hub
Browse files
hf_env/lib/python3.14/site-packages/pandas/tests/indexes/period/test_freq_attr.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
|
| 3 |
+
from pandas import (
|
| 4 |
+
offsets,
|
| 5 |
+
period_range,
|
| 6 |
+
)
|
| 7 |
+
import pandas._testing as tm
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class TestFreq:
|
| 11 |
+
def test_freq_setter_deprecated(self):
|
| 12 |
+
# GH#20678
|
| 13 |
+
idx = period_range("2018Q1", periods=4, freq="Q")
|
| 14 |
+
|
| 15 |
+
# no warning for getter
|
| 16 |
+
with tm.assert_produces_warning(None):
|
| 17 |
+
idx.freq
|
| 18 |
+
|
| 19 |
+
# warning for setter
|
| 20 |
+
msg = "property 'freq' of 'PeriodArray' object has no setter"
|
| 21 |
+
with pytest.raises(AttributeError, match=msg):
|
| 22 |
+
idx.freq = offsets.Day()
|