Skip to content

Commit 6347369

Browse files
committed
TST: Add regression test for bad promotion error/path
1 parent 0b723bc commit 6347369

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

numpy/_core/tests/test_stringdtype.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,15 @@ def test_add_promoter(string_list):
845845
np.add("a", "b", signature=("U", "U", StringDType))
846846

847847

848+
def test_add_no_legacy_promote_with_signature():
849+
# Possibly misplaced, but useful to test with string DType. We check that
850+
# if there is clearly no loop found, a stray `dtype=` doesn't break things
851+
# Regression test for the bad error in gh-26735
852+
# (If legacy promotion is gone, this can be deleted...)
853+
with pytest.raises(TypeError, match=".*did not contain a loop"):
854+
np.add("3", 6, dtype=StringDType)
855+
856+
848857
def test_add_promoter_reduce():
849858
# Exact TypeError could change, but ensure StringDtype doesn't match
850859
with pytest.raises(TypeError, match="the resolved dtypes are not"):

0 commit comments

Comments
 (0)