From a5835ca8a720d2c0a5cddb736c6f090fa8a2472a Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:29:59 -0800 Subject: [PATCH] Adjust test_datetime_infer_format for pandas 2.2 --- python/cudf/cudf/tests/test_datetime.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/python/cudf/cudf/tests/test_datetime.py b/python/cudf/cudf/tests/test_datetime.py index 513123a65d3..6f8e4ec0a1a 100644 --- a/python/cudf/cudf/tests/test_datetime.py +++ b/python/cudf/cudf/tests/test_datetime.py @@ -1275,23 +1275,23 @@ def test_datetime_reductions(data, op, dtype): assert_eq(expected, actual) -@pytest.mark.parametrize("timezone", ["naive", "UTC"]) +@pytest.mark.parametrize("timezone", ["", "Z"]) @pytest.mark.parametrize( "data", [ - np.arange("2002-10-27T04:30", 4 * 60, 60, dtype="M8[m]"), - np.arange("2002-10-27T04:30", 10 * 60, 1, dtype="M8[m]"), - np.arange("2002-10-27T04:30", 10 * 60, 1, dtype="M8[ns]"), - np.arange("2002-10-27T04:30", 10 * 60, 1, dtype="M8[us]"), - np.arange("2002-10-27T04:30", 4 * 60, 60, dtype="M8[s]"), + "2002-10-27T04:30", + "2002-10-27T04:30:00", + "2002-10-27T04:30:00.000", + "2002-10-27T04:30:00.000000", + "2002-10-27T04:30:00.000000000", ], ) @pytest.mark.parametrize("dtype", DATETIME_TYPES) def test_datetime_infer_format(data, timezone, dtype): - ts_data = np.datetime_as_string(data, timezone=timezone) + ts_data = [data + timezone] sr = cudf.Series(ts_data) psr = pd.Series(ts_data) - if timezone == "naive": + if not timezone: expected = psr.astype(dtype) actual = sr.astype(dtype)