Check that the left and right SparseArray are equal. Parameters ---------- left : SparseArray right : SparseArray
(left, right)
| 1404 | |
| 1405 | |
| 1406 | def assert_sp_array_equal(left, right) -> None: |
| 1407 | """ |
| 1408 | Check that the left and right SparseArray are equal. |
| 1409 | |
| 1410 | Parameters |
| 1411 | ---------- |
| 1412 | left : SparseArray |
| 1413 | right : SparseArray |
| 1414 | """ |
| 1415 | _check_isinstance(left, right, pd.arrays.SparseArray) |
| 1416 | |
| 1417 | assert_numpy_array_equal(left.sp_values, right.sp_values) |
| 1418 | |
| 1419 | # SparseIndex comparison |
| 1420 | assert isinstance(left.sp_index, SparseIndex) |
| 1421 | assert isinstance(right.sp_index, SparseIndex) |
| 1422 | |
| 1423 | left_index = left.sp_index |
| 1424 | right_index = right.sp_index |
| 1425 | |
| 1426 | if not left_index.equals(right_index): |
| 1427 | raise_assert_detail( |
| 1428 | "SparseArray.index", "index are not equal", left_index, right_index |
| 1429 | ) |
| 1430 | else: |
| 1431 | # Just ensure a |
| 1432 | pass |
| 1433 | |
| 1434 | assert_attr_equal("fill_value", left, right) |
| 1435 | assert_attr_equal("dtype", left, right) |
| 1436 | assert_numpy_array_equal(left.to_dense(), right.to_dense()) |
| 1437 | |
| 1438 | |
| 1439 | def assert_contains_all(iterable, dic) -> None: |
nothing calls this directly
no test coverage detected