Skip to content

Commit 4a9f225

Browse files
merge master
1 parent 42b4c97 commit 4a9f225

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pandas/core/sparse/frame.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ def sp_maker(x, index=None):
432432

433433
elif isinstance(value, SparseArray):
434434
if len(value) != len(self.index):
435-
raise AssertionError('Length of values does not match '
436-
'length of index')
435+
raise ValueError('Length of values does not match '
436+
'length of index')
437437
clean = value
438438

439439
elif hasattr(value, '__iter__'):
@@ -443,8 +443,8 @@ def sp_maker(x, index=None):
443443
clean = sp_maker(clean)
444444
else:
445445
if len(value) != len(self.index):
446-
raise AssertionError('Length of values does not match '
447-
'length of index')
446+
raise ValueError('Length of values does not match '
447+
'length of index')
448448
clean = sp_maker(value)
449449

450450
# Scalar

pandas/tests/sparse/frame/test_frame.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,9 @@ def _check_frame(frame, orig):
568568
assert len(frame['I'].sp_values) == N // 2
569569

570570
# insert ndarray wrong size
571-
msg = "Length of values does not match length of index"
572-
with pytest.raises(AssertionError, match=msg):
571+
# GH 25484
572+
msg = 'Length of values does not match length of index'
573+
with pytest.raises(ValueError, match=msg):
573574
frame['foo'] = np.random.randn(N - 1)
574575

575576
# scalar value

0 commit comments

Comments
 (0)