From d466e24f67fad080471a294479e581ad734e823d Mon Sep 17 00:00:00 2001 From: KevsterAmp Date: Thu, 19 Dec 2024 19:41:18 +0800 Subject: [PATCH] replace ValueError assertion with FutureWarning when copy=False --- pandas/tests/copy_view/test_array.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/copy_view/test_array.py b/pandas/tests/copy_view/test_array.py index 06d9424450011..0dabec6014b0d 100644 --- a/pandas/tests/copy_view/test_array.py +++ b/pandas/tests/copy_view/test_array.py @@ -187,7 +187,8 @@ def test_dataframe_multiple_numpy_dtypes(): if np_version_gt2: # copy=False semantics are only supported in NumPy>=2. - with pytest.raises(ValueError, match="Unable to avoid copy while creating"): + msg = "Starting with NumPy 2.0, the behavior of the 'copy' keyword has changed" + with pytest.raises(FutureWarning, match=msg): arr = np.array(df, copy=False) arr = np.array(df, copy=True)