Skip to content

TST: troubleshoot npdev build #31594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from pandas._config import get_option

from pandas._libs import lib, properties, reshape, tslibs
from pandas._libs.index import validate_numeric_casting
from pandas._typing import Label
from pandas.compat.numpy import function as nv
from pandas.util._decorators import Appender, Substitution
Expand Down Expand Up @@ -1022,7 +1023,7 @@ def __setitem__(self, key, value):
def _set_with_engine(self, key, value):
# fails with AttributeError for IntervalIndex
loc = self.index._engine.get_loc(key)
libindex.validate_numeric_casting(self.dtype, value)
validate_numeric_casting(self.dtype, value)
self._values[loc] = value

def _set_with(self, key, value):
Expand Down Expand Up @@ -1105,7 +1106,7 @@ def _set_value(self, label, value, takeable: bool = False):
self._values[label] = value
else:
loc = self.index.get_loc(label)
libindex.validate_numeric_casting(self.dtype, value)
validate_numeric_casting(self.dtype, value)
self._values[loc] = value
except KeyError:

Expand Down
2 changes: 2 additions & 0 deletions pandas/tests/dtypes/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,8 @@ def test__get_dtype(input_param, result):
)
def test__get_dtype_fails(input_param, expected_error_message):
# python objects
# 2020-02-02 npdev changed error message
expected_error_message += f"|Cannot interpret '{input_param}' as a data type"
with pytest.raises(TypeError, match=expected_error_message):
com._get_dtype(input_param)

Expand Down
7 changes: 6 additions & 1 deletion pandas/tests/dtypes/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ def test_equality_invalid(self, dtype):
assert not is_dtype_equal(dtype, np.int64)

def test_numpy_informed(self, dtype):
with pytest.raises(TypeError, match="data type not understood"):
# npdev 2020-02-02 changed from "data type not understood" to
# "Cannot interpret 'foo' as a data type"
msg = "|".join(
["data type not understood", "Cannot interpret '.*' as a data type"]
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we simply shouldn't test the message here, we are literally testing numpy here

with pytest.raises(TypeError, match=msg):
np.dtype(dtype)

assert not dtype == np.str_
Expand Down