From ea90f26ab6c42fad87784d165d7e5ab40f36dfae Mon Sep 17 00:00:00 2001 From: Natalia Mokeeva <91160475+natmokval@users.noreply.github.com> Date: Wed, 28 Jun 2023 09:40:40 +0200 Subject: [PATCH] TST: add test with freq=2M for period_array from datetime64 (#53890) --- pandas/tests/arrays/period/test_constructors.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pandas/tests/arrays/period/test_constructors.py b/pandas/tests/arrays/period/test_constructors.py index 8c3c2bd095adf..4e8ab56435749 100644 --- a/pandas/tests/arrays/period/test_constructors.py +++ b/pandas/tests/arrays/period/test_constructors.py @@ -56,6 +56,15 @@ def test_from_datetime64_freq_changes(): tm.assert_period_array_equal(result, expected) +def test_from_datetime64_freq_2M(): + arr = np.array( + ["2020-01-01T00:00:00", "2020-01-02T00:00:00"], dtype="datetime64[ns]" + ) + result = PeriodArray._from_datetime64(arr, "2M") + expected = period_array(["2020-01", "2020-01"], freq="2M") + tm.assert_period_array_equal(result, expected) + + @pytest.mark.parametrize( "data, freq, msg", [