Skip to content

Commit

Permalink
update exception message for numpy 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Apr 29, 2024
1 parent 02bdc58 commit 9b977f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pandas/tests/series/indexing/test_getitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
conversion,
timezones,
)
from pandas.compat.numpy import np_version_gt2

from pandas.core.dtypes.common import is_scalar

Expand Down Expand Up @@ -113,8 +114,12 @@ def test_getitem_keyerror_with_integer_index(self, any_int_numpy_dtype):
ser["c"]

def test_getitem_int64(self, datetime_series):
if np_version_gt2:
msg = r"^np.int64\(5\)$"
else:
msg = "^5$"
idx = np.int64(5)
with pytest.raises(KeyError, match="^5$"):
with pytest.raises(KeyError, match=msg):
datetime_series[idx]

def test_getitem_full_range(self):
Expand Down

0 comments on commit 9b977f6

Please sign in to comment.