@@ -266,10 +266,15 @@ def test_tick_rdiv(cls):
266
266
off = cls (10 )
267
267
delta = off .delta
268
268
td64 = delta .to_timedelta64 ()
269
+ instance__type = "." .join ([cls .__module__ , cls .__name__ ])
270
+ msg = (
271
+ "unsupported operand type\\ (s\\ ) for \\ /: 'int'|'float' and "
272
+ f"'{ instance__type } '"
273
+ )
269
274
270
- with pytest .raises (TypeError ):
275
+ with pytest .raises (TypeError , match = msg ):
271
276
2 / off
272
- with pytest .raises (TypeError ):
277
+ with pytest .raises (TypeError , match = msg ):
273
278
2.0 / off
274
279
275
280
assert (td64 * 2.5 ) / off == 2.5
@@ -330,14 +335,20 @@ def test_compare_ticks_to_strs(cls):
330
335
assert not off == "infer"
331
336
assert not "foo" == off
332
337
338
+ instance_type = "." .join ([cls .__module__ , cls .__name__ ])
339
+ msg = (
340
+ "'<'|'<='|'>'|'>=' not supported between instances of "
341
+ f"'str' and '{ instance_type } '|'{ instance_type } ' and 'str'"
342
+ )
343
+
333
344
for left , right in [("infer" , off ), (off , "infer" )]:
334
- with pytest .raises (TypeError ):
345
+ with pytest .raises (TypeError , match = msg ):
335
346
left < right
336
- with pytest .raises (TypeError ):
347
+ with pytest .raises (TypeError , match = msg ):
337
348
left <= right
338
- with pytest .raises (TypeError ):
349
+ with pytest .raises (TypeError , match = msg ):
339
350
left > right
340
- with pytest .raises (TypeError ):
351
+ with pytest .raises (TypeError , match = msg ):
341
352
left >= right
342
353
343
354
0 commit comments