@@ -17,26 +17,25 @@ class TestArithmeticOps(BaseOpsUtil):
17
17
def test_error (self , data , all_arithmetic_operators ):
18
18
# invalid ops
19
19
20
- op = all_arithmetic_operators
21
- s = pd .Series (data )
22
- ops = getattr (s , op )
23
- opa = getattr (data , op )
24
-
25
- # invalid scalars
26
- with pytest .raises (TypeError ):
20
+ msg = "invalid scalars"
21
+ with pytest .raises (TypeError , match = msg ):
27
22
ops ("foo" )
28
- with pytest .raises (TypeError ):
23
+ with pytest .raises (TypeError , match = msg )
29
24
ops (pd .Timestamp ("20180101" ))
30
25
26
+
31
27
# invalid array-likes
32
- if op not in ("__mul__" , "__rmul__" ):
33
- # TODO(extension) numpy's mul with object array sees booleans as numbers
34
- with pytest .raises (TypeError ):
35
- ops (pd .Series ("foo" , index = s .index ))
28
+ if op not in ("__mul__" , "__rmul__" ):
29
+ # TODO(extension) numpy's mul with object array sees booleans as numbers
30
+ msg = "invalid array-likes,numpy's mul with object array sees booleans as numbers"
31
+ with pytest .raises (TypeError , match = msg ):
32
+ ops (pd .Series ("foo" , index = s .index ))
33
+
36
34
37
35
# 2d
38
36
result = opa (pd .DataFrame ({"A" : s }))
39
37
assert result is NotImplemented
40
38
41
- with pytest .raises (NotImplementedError ):
39
+ msg = "invalid array-likes"
40
+ with pytest .raises (NotImplementedError , match = msg ):
42
41
opa (np .arange (len (s )).reshape (- 1 , len (s )))
0 commit comments