Skip to content

Commit 1820f78

Browse files
committed
replace msg with first part instead of the whole
1 parent ce83e09 commit 1820f78

File tree

4 files changed

+4
-20
lines changed

4 files changed

+4
-20
lines changed

pandas/tests/arrays/sparse/test_array.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,7 @@ def test_array_interface(arr_data, arr):
500500
# copy=False semantics are only supported in NumPy>=2.
501501
return
502502

503-
msg = "Starting on NumPy 2.0, the behavior of the 'copy' keyword has changed "
504-
"and passing 'copy=False' raises an error when a zero-copy NumPy array "
505-
"is not possible, Pandas will follow this behavior starting with "
506-
"version 3.0. This conversion to NumPy requires a copy, but "
507-
"'copy=False' was passed. Consider using 'np.asarray(..)' instead."
503+
msg = "Starting with NumPy 2.0, the behavior of the 'copy' keyword has changed"
508504
with tm.assert_produces_warning(FutureWarning, match=msg):
509505
np.array(arr, copy=False)
510506

pandas/tests/base/test_conversion.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,7 @@ def test_to_numpy(arr, expected, zero_copy, index_or_series_or_array):
380380
return
381381

382382
if not zero_copy:
383-
msg = "Starting on NumPy 2.0, the behavior of the 'copy' keyword has changed "
384-
"and passing 'copy=False' raises an error when a zero-copy NumPy array "
385-
"is not possible, Pandas will follow this behavior starting with "
386-
"version 3.0. This conversion to NumPy requires a copy, but "
387-
"'copy=False' was passed. Consider using 'np.asarray(..)' instead."
383+
msg = "Starting with NumPy 2.0, the behavior of the 'copy' keyword has changed"
388384
with tm.assert_produces_warning(FutureWarning, match=msg):
389385
np.array(thing, copy=False)
390386

pandas/tests/extension/base/interface.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,7 @@ def test_array_interface_copy(self, data):
8282
# copy=False semantics are only supported in NumPy>=2.
8383
return
8484

85-
msg = "Starting on NumPy 2.0, the behavior of the 'copy' keyword has changed "
86-
"and passing 'copy=False' raises an error when a zero-copy NumPy array "
87-
"is not possible, Pandas will follow this behavior starting with "
88-
"version 3.0. This conversion to NumPy requires a copy, but "
89-
"'copy=False' was passed. Consider using 'np.asarray(..)' instead."
85+
msg = "Starting with NumPy 2.0, the behavior of the 'copy' keyword has changed"
9086
with tm.assert_produces_warning(FutureWarning, match=msg):
9187
result_nocopy1 = np.array(data, copy=False)
9288

pandas/tests/indexes/multi/test_conversion.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ def test_array_interface(idx):
4747
return
4848

4949
# for MultiIndex, copy=False is never allowed
50-
msg = "Starting on NumPy 2.0, the behavior of the 'copy' keyword has changed "
51-
"and passing 'copy=False' raises an error when a zero-copy NumPy array "
52-
"is not possible, Pandas will follow this behavior starting with "
53-
"version 3.0. This conversion to NumPy requires a copy, but "
54-
"'copy=False' was passed. Consider using 'np.asarray(..)' instead."
50+
msg = "Starting with NumPy 2.0, the behavior of the 'copy' keyword has changed"
5551
with tm.assert_produces_warning(FutureWarning, match=msg):
5652
np.array(idx, copy=False)
5753

0 commit comments

Comments
 (0)