@@ -975,7 +975,7 @@ def test_sum_mixed_datetime(self):
975
975
df = DataFrame ({"A" : date_range ("2000" , periods = 4 ), "B" : [1 , 2 , 3 , 4 ]}).reindex (
976
976
[2 , 3 , 4 ]
977
977
)
978
- with pytest .raises (TypeError , match = "does not support reduction 'sum'" ):
978
+ with pytest .raises (TypeError , match = "does not support operation 'sum'" ):
979
979
df .sum ()
980
980
981
981
def test_mean_corner (self , float_frame , float_string_frame ):
@@ -1381,7 +1381,7 @@ def test_any_datetime(self):
1381
1381
]
1382
1382
df = DataFrame ({"A" : float_data , "B" : datetime_data })
1383
1383
1384
- msg = "datetime64 type does not support operation: 'any'"
1384
+ msg = "datetime64 type does not support operation 'any'"
1385
1385
with pytest .raises (TypeError , match = msg ):
1386
1386
df .any (axis = 1 )
1387
1387
@@ -1466,18 +1466,18 @@ def test_any_all_np_func(self, func, data, expected):
1466
1466
1467
1467
if any (isinstance (x , CategoricalDtype ) for x in data .dtypes ):
1468
1468
with pytest .raises (
1469
- TypeError , match = "dtype category does not support reduction "
1469
+ TypeError , match = ".* dtype category does not support operation "
1470
1470
):
1471
1471
func (data )
1472
1472
1473
1473
# method version
1474
1474
with pytest .raises (
1475
- TypeError , match = "dtype category does not support reduction "
1475
+ TypeError , match = ".* dtype category does not support operation "
1476
1476
):
1477
1477
getattr (DataFrame (data ), func .__name__ )(axis = None )
1478
1478
if data .dtypes .apply (lambda x : x .kind == "M" ).any ():
1479
1479
# GH#34479
1480
- msg = "datetime64 type does not support operation: '(any|all)'"
1480
+ msg = "datetime64 type does not support operation '(any|all)'"
1481
1481
with pytest .raises (TypeError , match = msg ):
1482
1482
func (data )
1483
1483
@@ -1734,19 +1734,19 @@ def test_any_all_categorical_dtype_nuisance_column(self, all_boolean_reductions)
1734
1734
df = ser .to_frame ()
1735
1735
1736
1736
# Double-check the Series behavior is to raise
1737
- with pytest .raises (TypeError , match = "does not support reduction " ):
1737
+ with pytest .raises (TypeError , match = "does not support operation " ):
1738
1738
getattr (ser , all_boolean_reductions )()
1739
1739
1740
- with pytest .raises (TypeError , match = "does not support reduction " ):
1740
+ with pytest .raises (TypeError , match = "does not support operation " ):
1741
1741
getattr (np , all_boolean_reductions )(ser )
1742
1742
1743
- with pytest .raises (TypeError , match = "does not support reduction " ):
1743
+ with pytest .raises (TypeError , match = "does not support operation " ):
1744
1744
getattr (df , all_boolean_reductions )(bool_only = False )
1745
1745
1746
- with pytest .raises (TypeError , match = "does not support reduction " ):
1746
+ with pytest .raises (TypeError , match = "does not support operation " ):
1747
1747
getattr (df , all_boolean_reductions )(bool_only = None )
1748
1748
1749
- with pytest .raises (TypeError , match = "does not support reduction " ):
1749
+ with pytest .raises (TypeError , match = "does not support operation " ):
1750
1750
getattr (np , all_boolean_reductions )(df , axis = 0 )
1751
1751
1752
1752
def test_median_categorical_dtype_nuisance_column (self ):
@@ -1755,22 +1755,22 @@ def test_median_categorical_dtype_nuisance_column(self):
1755
1755
ser = df ["A" ]
1756
1756
1757
1757
# Double-check the Series behavior is to raise
1758
- with pytest .raises (TypeError , match = "does not support reduction " ):
1758
+ with pytest .raises (TypeError , match = "does not support operation " ):
1759
1759
ser .median ()
1760
1760
1761
- with pytest .raises (TypeError , match = "does not support reduction " ):
1761
+ with pytest .raises (TypeError , match = "does not support operation " ):
1762
1762
df .median (numeric_only = False )
1763
1763
1764
- with pytest .raises (TypeError , match = "does not support reduction " ):
1764
+ with pytest .raises (TypeError , match = "does not support operation " ):
1765
1765
df .median ()
1766
1766
1767
1767
# same thing, but with an additional non-categorical column
1768
1768
df ["B" ] = df ["A" ].astype (int )
1769
1769
1770
- with pytest .raises (TypeError , match = "does not support reduction " ):
1770
+ with pytest .raises (TypeError , match = "does not support operation " ):
1771
1771
df .median (numeric_only = False )
1772
1772
1773
- with pytest .raises (TypeError , match = "does not support reduction " ):
1773
+ with pytest .raises (TypeError , match = "does not support operation " ):
1774
1774
df .median ()
1775
1775
1776
1776
# TODO: np.median(df, axis=0) gives np.array([2.0, 2.0]) instead
@@ -1964,7 +1964,7 @@ def test_minmax_extensionarray(method, numeric_only):
1964
1964
def test_frame_mixed_numeric_object_with_timestamp (ts_value ):
1965
1965
# GH 13912
1966
1966
df = DataFrame ({"a" : [1 ], "b" : [1.1 ], "c" : ["foo" ], "d" : [ts_value ]})
1967
- with pytest .raises (TypeError , match = "does not support reduction " ):
1967
+ with pytest .raises (TypeError , match = "does not support operation " ):
1968
1968
df .sum ()
1969
1969
1970
1970
0 commit comments