def assert_sp_array_equal(left, right, check_dtype=True):
 assertIsInstance(left, pd.SparseArray, '[SparseArray]')
 assertIsInstance(right, pd.SparseArray, '[SparseArray]')
 assert_numpy_array_equal(left.sp_values, right.sp_values, check_dtype=check_dtype)
 assertIsInstance(left.sp_index, pd._sparse.SparseIndex, '[SparseIndex]')
 assertIsInstance(right.sp_index, pd._sparse.SparseIndex, '[SparseIndex]')
 if (not left.sp_index.equals(right.sp_index)):
  raise_assert_detail('SparseArray.index', 'index are not equal', left.sp_index, right.sp_index)
 assert_attr_equal('fill_value', left, right)
 if check_dtype:
  assert_attr_equal('dtype', left, right)
 assert_numpy_array_equal(left.values, right.values, check_dtype=check_dtype)

def assert_sp_array_equal ( left , right , check_dtype = True ) : assertIsInstance ( left , pd . SparseArray , '[SparseArray]' ) assertIsInstance ( right , pd . SparseArray , '[SparseArray]' ) assert_numpy_array_equal ( left . sp_values , right . sp_values , check_dtype = check_dtype ) assertIsInstance ( left . sp_index , pd . _sparse . SparseIndex , '[SparseIndex]' ) assertIsInstance ( right . sp_index , pd . _sparse . SparseIndex , '[SparseIndex]' ) if ( not left . sp_index . equals ( right . sp_index ) ) : raise_assert_detail ( 'SparseArray.index' , 'index are not equal' , left . sp_index , right . sp_index ) assert_attr_equal ( 'fill_value' , left , right ) if check_dtype : assert_attr_equal ( 'dtype' , left , right ) assert_numpy_array_equal ( left . values , right . values , check_dtype = check_dtype )
check that the left and right sparsearray are equal .