From 3c539657a3165625886a051fd4b80b16ef088c2e Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Sun, 2 Feb 2020 19:03:24 -0800 Subject: [PATCH 1/2] TST: troubleshoot npdev build (#31594) --- pandas/core/series.py | 1 - pandas/tests/dtypes/test_common.py | 2 ++ pandas/tests/dtypes/test_dtypes.py | 11 ++++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 6a2a30a3efa17..023819518dc00 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -1138,7 +1138,6 @@ def _set_value(self, label, value, takeable: bool = False): else: self.index._engine.set_value(self._values, label, value) except (KeyError, TypeError): - # set using a non-recursive method self.loc[label] = value diff --git a/pandas/tests/dtypes/test_common.py b/pandas/tests/dtypes/test_common.py index 097e83d93ee71..4c917b9bb42d2 100644 --- a/pandas/tests/dtypes/test_common.py +++ b/pandas/tests/dtypes/test_common.py @@ -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) diff --git a/pandas/tests/dtypes/test_dtypes.py b/pandas/tests/dtypes/test_dtypes.py index fddd6239df309..1335ea63e1d1d 100644 --- a/pandas/tests/dtypes/test_dtypes.py +++ b/pandas/tests/dtypes/test_dtypes.py @@ -42,9 +42,14 @@ def test_equality_invalid(self): assert not self.dtype == "foo" assert not is_dtype_equal(self.dtype, np.int64) - def test_numpy_informed(self): - with pytest.raises(TypeError, match="data type not understood"): - np.dtype(self.dtype) + def test_numpy_informed(self, dtype): + # 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"] + ) + with pytest.raises(TypeError, match=msg): + np.dtype(dtype) assert not self.dtype == np.str_ assert not np.str_ == self.dtype From 2efab636c9aa4b671507345d329e98a1091a3f80 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Mon, 3 Feb 2020 12:29:57 +0100 Subject: [PATCH 2/2] fixup --- pandas/tests/dtypes/test_dtypes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/dtypes/test_dtypes.py b/pandas/tests/dtypes/test_dtypes.py index 1335ea63e1d1d..4475be12f3ff8 100644 --- a/pandas/tests/dtypes/test_dtypes.py +++ b/pandas/tests/dtypes/test_dtypes.py @@ -42,14 +42,14 @@ def test_equality_invalid(self): assert not self.dtype == "foo" assert not is_dtype_equal(self.dtype, np.int64) - def test_numpy_informed(self, dtype): + def test_numpy_informed(self): # 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"] ) with pytest.raises(TypeError, match=msg): - np.dtype(dtype) + np.dtype(self.dtype) assert not self.dtype == np.str_ assert not np.str_ == self.dtype