@@ -1461,53 +1461,25 @@ def to_array(obj):
1461
1461
# Sparse
1462
1462
1463
1463
1464
- def assert_sp_array_equal (
1465
- left ,
1466
- right ,
1467
- check_dtype = True ,
1468
- check_kind = True ,
1469
- check_fill_value = True ,
1470
- consolidate_block_indices = False ,
1471
- ):
1464
+ def assert_sp_array_equal (left , right ):
1472
1465
"""
1473
1466
Check that the left and right SparseArray are equal.
1474
1467
1475
1468
Parameters
1476
1469
----------
1477
1470
left : SparseArray
1478
1471
right : SparseArray
1479
- check_dtype : bool, default True
1480
- Whether to check the data dtype is identical.
1481
- check_kind : bool, default True
1482
- Whether to just the kind of the sparse index for each column.
1483
- check_fill_value : bool, default True
1484
- Whether to check that left.fill_value matches right.fill_value
1485
- consolidate_block_indices : bool, default False
1486
- Whether to consolidate contiguous blocks for sparse arrays with
1487
- a BlockIndex. Some operations, e.g. concat, will end up with
1488
- block indices that could be consolidated. Setting this to true will
1489
- create a new BlockIndex for that array, with consolidated
1490
- block indices.
1491
1472
"""
1492
1473
_check_isinstance (left , right , pd .arrays .SparseArray )
1493
1474
1494
- assert_numpy_array_equal (left .sp_values , right .sp_values , check_dtype = check_dtype )
1475
+ assert_numpy_array_equal (left .sp_values , right .sp_values )
1495
1476
1496
1477
# SparseIndex comparison
1497
1478
assert isinstance (left .sp_index , pd ._libs .sparse .SparseIndex )
1498
1479
assert isinstance (right .sp_index , pd ._libs .sparse .SparseIndex )
1499
1480
1500
- if not check_kind :
1501
- left_index = left .sp_index .to_block_index ()
1502
- right_index = right .sp_index .to_block_index ()
1503
- else :
1504
- left_index = left .sp_index
1505
- right_index = right .sp_index
1506
-
1507
- if consolidate_block_indices and left .kind == "block" :
1508
- # we'll probably remove this hack...
1509
- left_index = left_index .to_int_index ().to_block_index ()
1510
- right_index = right_index .to_int_index ().to_block_index ()
1481
+ left_index = left .sp_index
1482
+ right_index = right .sp_index
1511
1483
1512
1484
if not left_index .equals (right_index ):
1513
1485
raise_assert_detail (
@@ -1517,11 +1489,9 @@ def assert_sp_array_equal(
1517
1489
# Just ensure a
1518
1490
pass
1519
1491
1520
- if check_fill_value :
1521
- assert_attr_equal ("fill_value" , left , right )
1522
- if check_dtype :
1523
- assert_attr_equal ("dtype" , left , right )
1524
- assert_numpy_array_equal (left .to_dense (), right .to_dense (), check_dtype = check_dtype )
1492
+ assert_attr_equal ("fill_value" , left , right )
1493
+ assert_attr_equal ("dtype" , left , right )
1494
+ assert_numpy_array_equal (left .to_dense (), right .to_dense ())
1525
1495
1526
1496
1527
1497
# -----------------------------------------------------------------------------
0 commit comments