From 62f2fcd340908225a90a188a80b307b63bba6b72 Mon Sep 17 00:00:00 2001 From: shubchat Date: Mon, 20 Jan 2020 05:41:14 +1100 Subject: [PATCH 1/9] Adding error messages issue 30999 --- pandas/tests/base/test_constructors.py | 17 ++++++++++------- pandas/tests/base/test_conversion.py | 9 +++++---- pandas/tests/base/test_ops.py | 8 +++++--- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/pandas/tests/base/test_constructors.py b/pandas/tests/base/test_constructors.py index 0b7274399aafc..eee592a0f9f21 100644 --- a/pandas/tests/base/test_constructors.py +++ b/pandas/tests/base/test_constructors.py @@ -53,13 +53,15 @@ def test_invalid_delegation(self): delegate = self.Delegate(self.Delegator()) - with pytest.raises(TypeError): + msg="The delegate method has not been overridden" + + with pytest.raises(TypeError, match=msg): delegate.foo - with pytest.raises(TypeError): + with pytest.raises(TypeError, match=msg): delegate.foo = 5 - with pytest.raises(TypeError): + with pytest.raises(TypeError, match=msg): delegate.foo() @pytest.mark.skipif(PYPY, reason="not relevant for PyPy") @@ -85,8 +87,8 @@ class T(NoNewAttributesMixin): t._freeze() assert "__frozen" in dir(t) assert getattr(t, "__frozen") - - with pytest.raises(AttributeError): + msg="No new attribute found" + with pytest.raises(AttributeError, match=msg): t.b = "test" assert not hasattr(t, "b") @@ -129,7 +131,8 @@ def test_constructor_datetime_outofbound(self, a, klass): # datetime64[non-ns] raise error, other cases result in object dtype # and preserve original data if a.dtype.kind == "M": - with pytest.raises(pd.errors.OutOfBoundsDatetime): + msg="The datatime object is out of bound" + with pytest.raises(pd.errors.OutOfBoundsDatetime, match=msg): klass(a) else: result = klass(a) @@ -138,5 +141,5 @@ def test_constructor_datetime_outofbound(self, a, klass): # Explicit dtype specified # Forced conversion fails for all -> all cases raise error - with pytest.raises(pd.errors.OutOfBoundsDatetime): + with pytest.raises(pd.errors.OutOfBoundsDatetime,match=msg): klass(a, dtype="datetime64[ns]") diff --git a/pandas/tests/base/test_conversion.py b/pandas/tests/base/test_conversion.py index 07a15d0619bb6..1ae0c01ea1861 100644 --- a/pandas/tests/base/test_conversion.py +++ b/pandas/tests/base/test_conversion.py @@ -303,7 +303,8 @@ def test_array(array, attr, index_or_series): def test_array_multiindex_raises(): idx = pd.MultiIndex.from_product([["A"], ["a", "b"]]) - with pytest.raises(ValueError, match="MultiIndex"): + msg="The array is multiindex and has no single backing array" + with pytest.raises(ValueError,match=msg): idx.array @@ -429,11 +430,11 @@ def test_to_numpy_na_value_numpy_dtype(container, values, dtype, na_value, expec def test_to_numpy_kwargs_raises(): # numpy s = pd.Series([1, 2, 3]) - match = r"to_numpy\(\) got an unexpected keyword argument 'foo'" - with pytest.raises(TypeError, match=match): + msg = r"to_numpy\(\) got an unexpected keyword argument 'foo'" + with pytest.raises(TypeError, match=msg): s.to_numpy(foo=True) # extension s = pd.Series([1, 2, 3], dtype="Int64") - with pytest.raises(TypeError, match=match): + with pytest.raises(TypeError, match=msg): s.to_numpy(foo=True) diff --git a/pandas/tests/base/test_ops.py b/pandas/tests/base/test_ops.py index 2693eb12dda71..6de847bcb62ab 100644 --- a/pandas/tests/base/test_ops.py +++ b/pandas/tests/base/test_ops.py @@ -126,8 +126,9 @@ def check_ops_properties(self, props, filter=None, ignore_failures=False): err = AttributeError if issubclass(type(o), DatetimeIndexOpsMixin): err = TypeError + msg="The object cannot be datatimelike" - with pytest.raises(err): + with pytest.raises(err,match=msg): getattr(o, op) @pytest.mark.parametrize("klass", [Series, DataFrame]) @@ -211,9 +212,10 @@ def test_none_comparison(self): if is_datetime64_dtype(o) or is_datetime64tz_dtype(o): # Following DatetimeIndex (and Timestamp) convention, # inequality comparisons with Series[datetime64] raise - with pytest.raises(TypeError): + msg="The dtype cannot be datetime64 or datetime64tz" + with pytest.raises(TypeError,match=msg): None > o - with pytest.raises(TypeError): + with pytest.raises(TypeError,match=msg): o > None else: result = None > o From 423f27e70fcbc43c4b7adad61677cca2a3b8f7a6 Mon Sep 17 00:00:00 2001 From: shubchat Date: Mon, 20 Jan 2020 06:03:13 +1100 Subject: [PATCH 2/9] Adding white spaces --- pandas/tests/base/test_constructors.py | 8 ++++---- pandas/tests/base/test_conversion.py | 4 ++-- pandas/tests/base/test_ops.py | 24 ++++++++++++++---------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/pandas/tests/base/test_constructors.py b/pandas/tests/base/test_constructors.py index eee592a0f9f21..6912c3ac9c5c8 100644 --- a/pandas/tests/base/test_constructors.py +++ b/pandas/tests/base/test_constructors.py @@ -53,7 +53,7 @@ def test_invalid_delegation(self): delegate = self.Delegate(self.Delegator()) - msg="The delegate method has not been overridden" + msg= "The delegate method has not been overridden" with pytest.raises(TypeError, match=msg): delegate.foo @@ -87,7 +87,7 @@ class T(NoNewAttributesMixin): t._freeze() assert "__frozen" in dir(t) assert getattr(t, "__frozen") - msg="No new attribute found" + msg= "No new attribute found" with pytest.raises(AttributeError, match=msg): t.b = "test" @@ -131,7 +131,7 @@ def test_constructor_datetime_outofbound(self, a, klass): # datetime64[non-ns] raise error, other cases result in object dtype # and preserve original data if a.dtype.kind == "M": - msg="The datatime object is out of bound" + msg= "The datatime object is out of bound" with pytest.raises(pd.errors.OutOfBoundsDatetime, match=msg): klass(a) else: @@ -141,5 +141,5 @@ def test_constructor_datetime_outofbound(self, a, klass): # Explicit dtype specified # Forced conversion fails for all -> all cases raise error - with pytest.raises(pd.errors.OutOfBoundsDatetime,match=msg): + with pytest.raises(pd.errors.OutOfBoundsDatetime, match=msg): klass(a, dtype="datetime64[ns]") diff --git a/pandas/tests/base/test_conversion.py b/pandas/tests/base/test_conversion.py index 1ae0c01ea1861..da6d0cf2cbba9 100644 --- a/pandas/tests/base/test_conversion.py +++ b/pandas/tests/base/test_conversion.py @@ -303,8 +303,8 @@ def test_array(array, attr, index_or_series): def test_array_multiindex_raises(): idx = pd.MultiIndex.from_product([["A"], ["a", "b"]]) - msg="The array is multiindex and has no single backing array" - with pytest.raises(ValueError,match=msg): + msg= "The array is multiindex and has no single backing array" + with pytest.raises(ValueError, match=msg): idx.array diff --git a/pandas/tests/base/test_ops.py b/pandas/tests/base/test_ops.py index 6de847bcb62ab..4eb1684b60932 100644 --- a/pandas/tests/base/test_ops.py +++ b/pandas/tests/base/test_ops.py @@ -126,9 +126,9 @@ def check_ops_properties(self, props, filter=None, ignore_failures=False): err = AttributeError if issubclass(type(o), DatetimeIndexOpsMixin): err = TypeError - msg="The object cannot be datatimelike" + msg= "The object cannot be datatimelike" - with pytest.raises(err,match=msg): + with pytest.raises(err, match=msg): getattr(o, op) @pytest.mark.parametrize("klass", [Series, DataFrame]) @@ -212,10 +212,10 @@ def test_none_comparison(self): if is_datetime64_dtype(o) or is_datetime64tz_dtype(o): # Following DatetimeIndex (and Timestamp) convention, # inequality comparisons with Series[datetime64] raise - msg="The dtype cannot be datetime64 or datetime64tz" - with pytest.raises(TypeError,match=msg): + msg= "The dtype cannot be datetime64 or datetime64tz" + with pytest.raises(TypeError, match=msg): None > o - with pytest.raises(TypeError,match=msg): + with pytest.raises(TypeError, match=msg): o > None else: result = None > o @@ -237,7 +237,8 @@ def test_ndarray_compat_properties(self): for p in ["flags", "strides", "itemsize", "base", "data"]: assert not hasattr(o, p) - with pytest.raises(ValueError): + msg="Ndarray not compatible" + with pytest.raises(ValueError,match=msg): o.item() # len > 1 assert o.ndim == 1 @@ -440,7 +441,8 @@ def test_value_counts_bins(self, index_or_series): s = klass(s_values) # bins - with pytest.raises(TypeError): + msg="No value counts for the corresponding object type" + with pytest.raises(TypeError,match=msg): s.value_counts(bins=1) s1 = Series([1, 1, 2, 3]) @@ -859,7 +861,8 @@ def test_validate_bool_args(self): invalid_values = [1, "True", [1, 2, 3], 5.0] for value in invalid_values: - with pytest.raises(ValueError): + msg="Boolean(True/False) argument needed but not provided" + with pytest.raises(ValueError,match=msg): self.int_series.drop_duplicates(inplace=value) def test_getitem(self): @@ -872,9 +875,10 @@ def test_getitem(self): assert i[-1] == i[9] - with pytest.raises(IndexError): + msg="Index out of bounds" + with pytest.raises(IndexError,match=msg): i[20] - with pytest.raises(IndexError): + with pytest.raises(IndexError),match=msg: s.iloc[20] @pytest.mark.parametrize("indexer_klass", [list, pd.Index]) From 4fa81a5b4e0fbca9a17b1c9864dad897968ae759 Mon Sep 17 00:00:00 2001 From: shubchat Date: Mon, 20 Jan 2020 06:40:10 +1100 Subject: [PATCH 3/9] flake8 corrections --- pandas/tests/base/test_constructors.py | 6 +++--- pandas/tests/base/test_conversion.py | 2 +- pandas/tests/base/test_ops.py | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pandas/tests/base/test_constructors.py b/pandas/tests/base/test_constructors.py index 6912c3ac9c5c8..229a856e0cc40 100644 --- a/pandas/tests/base/test_constructors.py +++ b/pandas/tests/base/test_constructors.py @@ -53,7 +53,7 @@ def test_invalid_delegation(self): delegate = self.Delegate(self.Delegator()) - msg= "The delegate method has not been overridden" + msg = "The delegate method has not been overridden" with pytest.raises(TypeError, match=msg): delegate.foo @@ -87,7 +87,7 @@ class T(NoNewAttributesMixin): t._freeze() assert "__frozen" in dir(t) assert getattr(t, "__frozen") - msg= "No new attribute found" + msg = "No new attribute found" with pytest.raises(AttributeError, match=msg): t.b = "test" @@ -131,7 +131,7 @@ def test_constructor_datetime_outofbound(self, a, klass): # datetime64[non-ns] raise error, other cases result in object dtype # and preserve original data if a.dtype.kind == "M": - msg= "The datatime object is out of bound" + msg = "The datatime object is out of bound" with pytest.raises(pd.errors.OutOfBoundsDatetime, match=msg): klass(a) else: diff --git a/pandas/tests/base/test_conversion.py b/pandas/tests/base/test_conversion.py index da6d0cf2cbba9..1e66a6e0fb3cf 100644 --- a/pandas/tests/base/test_conversion.py +++ b/pandas/tests/base/test_conversion.py @@ -303,7 +303,7 @@ def test_array(array, attr, index_or_series): def test_array_multiindex_raises(): idx = pd.MultiIndex.from_product([["A"], ["a", "b"]]) - msg= "The array is multiindex and has no single backing array" + msg = "The array is multiindex and has no single backing array" with pytest.raises(ValueError, match=msg): idx.array diff --git a/pandas/tests/base/test_ops.py b/pandas/tests/base/test_ops.py index 4eb1684b60932..a177a2c79f363 100644 --- a/pandas/tests/base/test_ops.py +++ b/pandas/tests/base/test_ops.py @@ -126,7 +126,7 @@ def check_ops_properties(self, props, filter=None, ignore_failures=False): err = AttributeError if issubclass(type(o), DatetimeIndexOpsMixin): err = TypeError - msg= "The object cannot be datatimelike" + msg = "The object cannot be datatimelike" with pytest.raises(err, match=msg): getattr(o, op) @@ -212,7 +212,7 @@ def test_none_comparison(self): if is_datetime64_dtype(o) or is_datetime64tz_dtype(o): # Following DatetimeIndex (and Timestamp) convention, # inequality comparisons with Series[datetime64] raise - msg= "The dtype cannot be datetime64 or datetime64tz" + msg = "The dtype cannot be datetime64 or datetime64tz" with pytest.raises(TypeError, match=msg): None > o with pytest.raises(TypeError, match=msg): @@ -237,8 +237,8 @@ def test_ndarray_compat_properties(self): for p in ["flags", "strides", "itemsize", "base", "data"]: assert not hasattr(o, p) - msg="Ndarray not compatible" - with pytest.raises(ValueError,match=msg): + msg = "Ndarray not compatible" + with pytest.raises(ValueError, match=msg): o.item() # len > 1 assert o.ndim == 1 @@ -441,8 +441,8 @@ def test_value_counts_bins(self, index_or_series): s = klass(s_values) # bins - msg="No value counts for the corresponding object type" - with pytest.raises(TypeError,match=msg): + msg = "No value counts for the corresponding object type" + with pytest.raises(TypeError, match=msg): s.value_counts(bins=1) s1 = Series([1, 1, 2, 3]) @@ -861,8 +861,8 @@ def test_validate_bool_args(self): invalid_values = [1, "True", [1, 2, 3], 5.0] for value in invalid_values: - msg="Boolean(True/False) argument needed but not provided" - with pytest.raises(ValueError,match=msg): + msg = "Boolean(True/False) argument needed but not provided" + with pytest.raises(ValueError, match=msg): self.int_series.drop_duplicates(inplace=value) def test_getitem(self): @@ -875,10 +875,10 @@ def test_getitem(self): assert i[-1] == i[9] - msg="Index out of bounds" - with pytest.raises(IndexError,match=msg): + msg = "Index out of bounds" + with pytest.raises(IndexError, match=msg): i[20] - with pytest.raises(IndexError),match=msg: + with pytest.raises(IndexError, match=msg): s.iloc[20] @pytest.mark.parametrize("indexer_klass", [list, pd.Index]) From 568bbdf440cb755c67cc2b91d662bda10c5aa1b2 Mon Sep 17 00:00:00 2001 From: shubchat Date: Tue, 21 Jan 2020 05:52:51 +1100 Subject: [PATCH 4/9] edits post CI failure jan 21st --- pandas/tests/base/test_constructors.py | 6 +++--- pandas/tests/base/test_ops.py | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pandas/tests/base/test_constructors.py b/pandas/tests/base/test_constructors.py index 229a856e0cc40..6e20d145dbb16 100644 --- a/pandas/tests/base/test_constructors.py +++ b/pandas/tests/base/test_constructors.py @@ -53,7 +53,7 @@ def test_invalid_delegation(self): delegate = self.Delegate(self.Delegator()) - msg = "The delegate method has not been overridden" + msg = "You cannot access the property" with pytest.raises(TypeError, match=msg): delegate.foo @@ -87,7 +87,7 @@ class T(NoNewAttributesMixin): t._freeze() assert "__frozen" in dir(t) assert getattr(t, "__frozen") - msg = "No new attribute found" + msg = "You cannot add any new attribute" with pytest.raises(AttributeError, match=msg): t.b = "test" @@ -131,7 +131,7 @@ def test_constructor_datetime_outofbound(self, a, klass): # datetime64[non-ns] raise error, other cases result in object dtype # and preserve original data if a.dtype.kind == "M": - msg = "The datatime object is out of bound" + msg = "Out of bounds" with pytest.raises(pd.errors.OutOfBoundsDatetime, match=msg): klass(a) else: diff --git a/pandas/tests/base/test_ops.py b/pandas/tests/base/test_ops.py index a177a2c79f363..c6986e36d1b9f 100644 --- a/pandas/tests/base/test_ops.py +++ b/pandas/tests/base/test_ops.py @@ -123,11 +123,10 @@ def check_ops_properties(self, props, filter=None, ignore_failures=False): # an object that is datetimelike will raise a TypeError, # otherwise an AttributeError + msg = "The object cannot be datetimelike" err = AttributeError if issubclass(type(o), DatetimeIndexOpsMixin): err = TypeError - msg = "The object cannot be datatimelike" - with pytest.raises(err, match=msg): getattr(o, op) From 81c907225c4172bab06157f54a4c06d0c537ec1e Mon Sep 17 00:00:00 2001 From: shubchat Date: Tue, 21 Jan 2020 06:44:40 +1100 Subject: [PATCH 5/9] other edits for CI --- pandas/tests/base/test_constructors.py | 10 ++++++---- pandas/tests/base/test_conversion.py | 2 +- pandas/tests/base/test_ops.py | 11 ++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/pandas/tests/base/test_constructors.py b/pandas/tests/base/test_constructors.py index 6e20d145dbb16..d755d254aa31d 100644 --- a/pandas/tests/base/test_constructors.py +++ b/pandas/tests/base/test_constructors.py @@ -53,14 +53,15 @@ def test_invalid_delegation(self): delegate = self.Delegate(self.Delegator()) - msg = "You cannot access the property" - + msg = "You cannot access the property foo" with pytest.raises(TypeError, match=msg): delegate.foo - + + msg = "The property foo cannot be set" with pytest.raises(TypeError, match=msg): delegate.foo = 5 - + + msg = "You cannot access the property foo" with pytest.raises(TypeError, match=msg): delegate.foo() @@ -141,5 +142,6 @@ def test_constructor_datetime_outofbound(self, a, klass): # Explicit dtype specified # Forced conversion fails for all -> all cases raise error + msg = "Out of bounds" with pytest.raises(pd.errors.OutOfBoundsDatetime, match=msg): klass(a, dtype="datetime64[ns]") diff --git a/pandas/tests/base/test_conversion.py b/pandas/tests/base/test_conversion.py index 1e66a6e0fb3cf..46fd1551e6170 100644 --- a/pandas/tests/base/test_conversion.py +++ b/pandas/tests/base/test_conversion.py @@ -303,7 +303,7 @@ def test_array(array, attr, index_or_series): def test_array_multiindex_raises(): idx = pd.MultiIndex.from_product([["A"], ["a", "b"]]) - msg = "The array is multiindex and has no single backing array" + msg = "MultiIndex has no single backing array" with pytest.raises(ValueError, match=msg): idx.array diff --git a/pandas/tests/base/test_ops.py b/pandas/tests/base/test_ops.py index c6986e36d1b9f..ce5c8287dd58d 100644 --- a/pandas/tests/base/test_ops.py +++ b/pandas/tests/base/test_ops.py @@ -211,7 +211,7 @@ def test_none_comparison(self): if is_datetime64_dtype(o) or is_datetime64tz_dtype(o): # Following DatetimeIndex (and Timestamp) convention, # inequality comparisons with Series[datetime64] raise - msg = "The dtype cannot be datetime64 or datetime64tz" + msg = "Invalid comparison" with pytest.raises(TypeError, match=msg): None > o with pytest.raises(TypeError, match=msg): @@ -236,7 +236,7 @@ def test_ndarray_compat_properties(self): for p in ["flags", "strides", "itemsize", "base", "data"]: assert not hasattr(o, p) - msg = "Ndarray not compatible" + msg = "can only convert an array of size 1 to a Python scalar" with pytest.raises(ValueError, match=msg): o.item() # len > 1 @@ -440,7 +440,7 @@ def test_value_counts_bins(self, index_or_series): s = klass(s_values) # bins - msg = "No value counts for the corresponding object type" + msg = "bins argument only works with numeric data" with pytest.raises(TypeError, match=msg): s.value_counts(bins=1) @@ -860,7 +860,7 @@ def test_validate_bool_args(self): invalid_values = [1, "True", [1, 2, 3], 5.0] for value in invalid_values: - msg = "Boolean(True/False) argument needed but not provided" + msg = "expected type bool" with pytest.raises(ValueError, match=msg): self.int_series.drop_duplicates(inplace=value) @@ -874,9 +874,10 @@ def test_getitem(self): assert i[-1] == i[9] - msg = "Index out of bounds" + msg = "index 20 is out of bounds for axis 0 with size 10" with pytest.raises(IndexError, match=msg): i[20] + msg = "single positional indexer is out-of-bounds" with pytest.raises(IndexError, match=msg): s.iloc[20] From dfc679886ec443fc858944e93152389efd3952a0 Mon Sep 17 00:00:00 2001 From: shubchat Date: Tue, 21 Jan 2020 06:46:00 +1100 Subject: [PATCH 6/9] other edits for CI --- pandas/tests/base/test_constructors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/base/test_constructors.py b/pandas/tests/base/test_constructors.py index d755d254aa31d..e27b5c307cd99 100644 --- a/pandas/tests/base/test_constructors.py +++ b/pandas/tests/base/test_constructors.py @@ -56,11 +56,11 @@ def test_invalid_delegation(self): msg = "You cannot access the property foo" with pytest.raises(TypeError, match=msg): delegate.foo - + msg = "The property foo cannot be set" with pytest.raises(TypeError, match=msg): delegate.foo = 5 - + msg = "You cannot access the property foo" with pytest.raises(TypeError, match=msg): delegate.foo() From d5f6e659e06ad903e4206439b8cebaeb4e70fd8f Mon Sep 17 00:00:00 2001 From: shubchat Date: Wed, 22 Jan 2020 05:47:26 +1100 Subject: [PATCH 7/9] other edits for CI --- pandas/tests/base/test_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/base/test_ops.py b/pandas/tests/base/test_ops.py index ce5c8287dd58d..a4811a483f04e 100644 --- a/pandas/tests/base/test_ops.py +++ b/pandas/tests/base/test_ops.py @@ -123,7 +123,7 @@ def check_ops_properties(self, props, filter=None, ignore_failures=False): # an object that is datetimelike will raise a TypeError, # otherwise an AttributeError - msg = "The object cannot be datetimelike" + msg = "'Index' object has no attribute 'year'" err = AttributeError if issubclass(type(o), DatetimeIndexOpsMixin): err = TypeError From fc8ec3b9f77e46a0d91db92e77df3ee01ee66aa6 Mon Sep 17 00:00:00 2001 From: shubchat Date: Wed, 22 Jan 2020 06:10:22 +1100 Subject: [PATCH 8/9] other edits for CI --- pandas/tests/base/test_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/base/test_ops.py b/pandas/tests/base/test_ops.py index a4811a483f04e..b02e9f0b38c86 100644 --- a/pandas/tests/base/test_ops.py +++ b/pandas/tests/base/test_ops.py @@ -123,7 +123,7 @@ def check_ops_properties(self, props, filter=None, ignore_failures=False): # an object that is datetimelike will raise a TypeError, # otherwise an AttributeError - msg = "'Index' object has no attribute 'year'" + msg = "object has no attribute 'year'" err = AttributeError if issubclass(type(o), DatetimeIndexOpsMixin): err = TypeError From 02de253f9ce53ba1ec48a5f7baa904fdcb25942b Mon Sep 17 00:00:00 2001 From: shubchat Date: Wed, 22 Jan 2020 06:45:34 +1100 Subject: [PATCH 9/9] other edits for CI --- pandas/tests/base/test_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/base/test_ops.py b/pandas/tests/base/test_ops.py index b02e9f0b38c86..08ec57bd69ad4 100644 --- a/pandas/tests/base/test_ops.py +++ b/pandas/tests/base/test_ops.py @@ -123,7 +123,7 @@ def check_ops_properties(self, props, filter=None, ignore_failures=False): # an object that is datetimelike will raise a TypeError, # otherwise an AttributeError - msg = "object has no attribute 'year'" + msg = "no attribute" err = AttributeError if issubclass(type(o), DatetimeIndexOpsMixin): err = TypeError