Skip to content

Commit 6501fa5

Browse files
TST: add test with freq=2M to increase coverage asfreq (#54183)
* TST: add test with freq=2M to increase coverage asfreq * rename --------- Co-authored-by: Marco Edward Gorelli <[email protected]>
1 parent 406abd9 commit 6501fa5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/indexes/period/methods/test_asfreq.py

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from pandas import (
44
PeriodIndex,
5+
Series,
56
period_range,
67
)
78
import pandas._testing as tm
@@ -128,3 +129,10 @@ def test_astype_asfreq(self):
128129
exp = PeriodIndex(["2011-01", "2011-02", "2011-03"], freq="3M")
129130
tm.assert_index_equal(pi1.asfreq("3M"), exp)
130131
tm.assert_index_equal(pi1.astype("period[3M]"), exp)
132+
133+
def test_asfreq_with_different_n(self):
134+
ser = Series([1, 2], index=PeriodIndex(["2020-01", "2020-03"], freq="2M"))
135+
result = ser.asfreq("M")
136+
137+
excepted = Series([1, 2], index=PeriodIndex(["2020-02", "2020-04"], freq="M"))
138+
tm.assert_series_equal(result, excepted)

0 commit comments

Comments
 (0)