Skip to content

Commit b4cbc19

Browse files
authored
Added in a error message (#32105)
1 parent d5d6834 commit b4cbc19

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/tests/arrays/test_array.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class DecimalArray2(DecimalArray):
291291
@classmethod
292292
def _from_sequence(cls, scalars, dtype=None, copy=False):
293293
if isinstance(scalars, (pd.Series, pd.Index)):
294-
raise TypeError
294+
raise TypeError("scalars should not be of type pd.Series or pd.Index")
295295

296296
return super()._from_sequence(scalars, dtype=dtype, copy=copy)
297297

@@ -301,7 +301,9 @@ def test_array_unboxes(index_or_series):
301301

302302
data = box([decimal.Decimal("1"), decimal.Decimal("2")])
303303
# make sure it works
304-
with pytest.raises(TypeError):
304+
with pytest.raises(
305+
TypeError, match="scalars should not be of type pd.Series or pd.Index"
306+
):
305307
DecimalArray2._from_sequence(data)
306308

307309
result = pd.array(data, dtype="decimal2")

0 commit comments

Comments
 (0)