Skip to content

Commit 27f365d

Browse files
authored
TST: troubleshoot npdev build (#31594)
1 parent cf8c680 commit 27f365d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

pandas/core/series.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from pandas._config import get_option
2424

2525
from pandas._libs import lib, properties, reshape, tslibs
26+
from pandas._libs.index import validate_numeric_casting
2627
from pandas._typing import Label
2728
from pandas.compat.numpy import function as nv
2829
from pandas.util._decorators import Appender, Substitution
@@ -1022,7 +1023,7 @@ def __setitem__(self, key, value):
10221023
def _set_with_engine(self, key, value):
10231024
# fails with AttributeError for IntervalIndex
10241025
loc = self.index._engine.get_loc(key)
1025-
libindex.validate_numeric_casting(self.dtype, value)
1026+
validate_numeric_casting(self.dtype, value)
10261027
self._values[loc] = value
10271028

10281029
def _set_with(self, key, value):
@@ -1105,7 +1106,7 @@ def _set_value(self, label, value, takeable: bool = False):
11051106
self._values[label] = value
11061107
else:
11071108
loc = self.index.get_loc(label)
1108-
libindex.validate_numeric_casting(self.dtype, value)
1109+
validate_numeric_casting(self.dtype, value)
11091110
self._values[loc] = value
11101111
except KeyError:
11111112

pandas/tests/dtypes/test_common.py

+2
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,8 @@ def test__get_dtype(input_param, result):
675675
)
676676
def test__get_dtype_fails(input_param, expected_error_message):
677677
# python objects
678+
# 2020-02-02 npdev changed error message
679+
expected_error_message += f"|Cannot interpret '{input_param}' as a data type"
678680
with pytest.raises(TypeError, match=expected_error_message):
679681
com._get_dtype(input_param)
680682

pandas/tests/dtypes/test_dtypes.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ def test_equality_invalid(self, dtype):
4040
assert not is_dtype_equal(dtype, np.int64)
4141

4242
def test_numpy_informed(self, dtype):
43-
with pytest.raises(TypeError, match="data type not understood"):
43+
# npdev 2020-02-02 changed from "data type not understood" to
44+
# "Cannot interpret 'foo' as a data type"
45+
msg = "|".join(
46+
["data type not understood", "Cannot interpret '.*' as a data type"]
47+
)
48+
with pytest.raises(TypeError, match=msg):
4449
np.dtype(dtype)
4550

4651
assert not dtype == np.str_

0 commit comments

Comments
 (0)