Skip to content

Commit

Permalink
CI: correct error msg in test_view_index (pandas-dev#58181)
Browse files Browse the repository at this point in the history
* correct error msg in test_view_index

* correct err msg
  • Loading branch information
natmokval authored and pmhatre1 committed May 7, 2024
1 parent 2ed9ef3 commit 059c23d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion pandas/tests/indexes/numeric/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ def test_cant_or_shouldnt_cast(self, dtype):

def test_view_index(self, simple_index):
index = simple_index
msg = "Cannot change data-type for object array"
msg = (
"Cannot change data-type for array of references.|"
"Cannot change data-type for object array.|"
)
with pytest.raises(TypeError, match=msg):
index.view(Index)

Expand Down
5 changes: 4 additions & 1 deletion pandas/tests/indexes/ranges/test_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,10 @@ def test_cant_or_shouldnt_cast(self, start, stop, step):

def test_view_index(self, simple_index):
index = simple_index
msg = "Cannot change data-type for object array"
msg = (
"Cannot change data-type for array of references.|"
"Cannot change data-type for object array.|"
)
with pytest.raises(TypeError, match=msg):
index.view(Index)

Expand Down
5 changes: 4 additions & 1 deletion pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,10 @@ def test_view_with_args_object_array_raises(self, index):
with pytest.raises(NotImplementedError, match="i8"):
index.view("i8")
else:
msg = "Cannot change data-type for object array"
msg = (
"Cannot change data-type for array of references.|"
"Cannot change data-type for object array.|"
)
with pytest.raises(TypeError, match=msg):
index.view("i8")

Expand Down
5 changes: 4 additions & 1 deletion pandas/tests/indexes/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def test_view(self, simple_index):
result = type(simple_index)(idx)
tm.assert_index_equal(result, idx)

msg = "Cannot change data-type for object array"
msg = (
"Cannot change data-type for array of references.|"
"Cannot change data-type for object array.|"
)
with pytest.raises(TypeError, match=msg):
idx.view(type(simple_index))

Expand Down
5 changes: 4 additions & 1 deletion pandas/tests/indexes/test_old_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,10 @@ def test_view(self, simple_index):
idx_view = idx.view(dtype)
tm.assert_index_equal(idx, index_cls(idx_view, name="Foo"), exact=True)

msg = "Cannot change data-type for object array"
msg = (
"Cannot change data-type for array of references.|"
"Cannot change data-type for object array.|"
)
with pytest.raises(TypeError, match=msg):
# GH#55709
idx.view(index_cls)
Expand Down

0 comments on commit 059c23d

Please sign in to comment.