Skip to content

Commit 0110210

Browse files
committed
update exception messages
1 parent 2c49f2e commit 0110210

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pandas/tests/arithmetic/test_timedelta64.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1984,7 +1984,16 @@ def test_td64arr_div_numeric_scalar(self, box_with_array, two):
19841984
result = tdser / two
19851985
tm.assert_equal(result, expected)
19861986

1987-
with pytest.raises(TypeError, match="Cannot divide"):
1987+
msg = "|".join(
1988+
[
1989+
"Cannot divide",
1990+
# 2021-12-09 npdev started giving a new message; not sure if it
1991+
# will be changed back
1992+
"ufunc 'divide' cannot use operands with types "
1993+
r"dtype\('float64'\) and dtype\('<m8\[ns\]'\)",
1994+
]
1995+
)
1996+
with pytest.raises(TypeError, match=msg):
19881997
two / tdser
19891998

19901999
@pytest.mark.parametrize("two", [2, 2.0, np.array(2), np.array(2.0)])
@@ -2061,6 +2070,9 @@ def test_td64arr_div_numeric_array(
20612070
"cannot perform __truediv__",
20622071
"unsupported operand",
20632072
"Cannot divide",
2073+
# 2021-12-09 new message on npdev
2074+
"ufunc 'divide' cannot use operands with types "
2075+
r"dtype\('float32'\) and dtype\('<m8\[ns\]'\)",
20642076
]
20652077
)
20662078
with pytest.raises(TypeError, match=pattern):

0 commit comments

Comments
 (0)