Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f56cba9

Browse files
authoredApr 8, 2024··
CI: correct error msg in test_view_index (#58181)
* correct error msg in test_view_index * correct err msg
1 parent f3ddd2b commit f56cba9

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed
 

‎pandas/tests/indexes/numeric/test_numeric.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,10 @@ def test_cant_or_shouldnt_cast(self, dtype):
312312

313313
def test_view_index(self, simple_index):
314314
index = simple_index
315-
msg = "Cannot change data-type for object array"
315+
msg = (
316+
"Cannot change data-type for array of references.|"
317+
"Cannot change data-type for object array.|"
318+
)
316319
with pytest.raises(TypeError, match=msg):
317320
index.view(Index)
318321

‎pandas/tests/indexes/ranges/test_range.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,10 @@ def test_cant_or_shouldnt_cast(self, start, stop, step):
375375

376376
def test_view_index(self, simple_index):
377377
index = simple_index
378-
msg = "Cannot change data-type for object array"
378+
msg = (
379+
"Cannot change data-type for array of references.|"
380+
"Cannot change data-type for object array.|"
381+
)
379382
with pytest.raises(TypeError, match=msg):
380383
index.view(Index)
381384

‎pandas/tests/indexes/test_base.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,10 @@ def test_view_with_args_object_array_raises(self, index):
358358
with pytest.raises(NotImplementedError, match="i8"):
359359
index.view("i8")
360360
else:
361-
msg = "Cannot change data-type for object array"
361+
msg = (
362+
"Cannot change data-type for array of references.|"
363+
"Cannot change data-type for object array.|"
364+
)
362365
with pytest.raises(TypeError, match=msg):
363366
index.view("i8")
364367

‎pandas/tests/indexes/test_datetimelike.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ def test_view(self, simple_index):
8888
result = type(simple_index)(idx)
8989
tm.assert_index_equal(result, idx)
9090

91-
msg = "Cannot change data-type for object array"
91+
msg = (
92+
"Cannot change data-type for array of references.|"
93+
"Cannot change data-type for object array.|"
94+
)
9295
with pytest.raises(TypeError, match=msg):
9396
idx.view(type(simple_index))
9497

‎pandas/tests/indexes/test_old_base.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ def test_view(self, simple_index):
880880
idx_view = idx.view(dtype)
881881
tm.assert_index_equal(idx, index_cls(idx_view, name="Foo"), exact=True)
882882

883-
msg = "Cannot change data-type for object array"
883+
msg = (
884+
"Cannot change data-type for array of references.|"
885+
"Cannot change data-type for object array.|"
886+
)
884887
with pytest.raises(TypeError, match=msg):
885888
# GH#55709
886889
idx.view(index_cls)

0 commit comments

Comments
 (0)
Please sign in to comment.