def test_sizeof(self, matrix, prepend_n_rows, prepend_n_cols,
                    n_prepend_bytes, partition, sliced_dimension, dtype):
        matrix = np.asarray(matrix, dtype=dtype)

        # Create the matrix region
        mr = MatrixRegion(
            matrix, prepend_n_rows=prepend_n_rows,
            prepend_n_columns=prepend_n_cols,
            sliced_dimension=sliced_dimension
        )

        # Get the partitioned matrix
        if sliced_dimension is None:
            slices = slice(None)
        else:
            slices = (
                tuple(slice(None) for _ in range(sliced_dimension)) +
                (partition, ) +
                tuple(slice(None) for _ in range(sliced_dimension + 1,
                                                 matrix.ndim))
            )

        # Check the size is correct
        assert (mr.sizeof(partition) ==
                n_prepend_bytes + matrix[slices].nbytes)
    def test_sizeof(self, matrix, prepend_n_rows, prepend_n_cols,
                    n_prepend_bytes, partition, sliced_dimension, dtype):
        matrix = np.asarray(matrix, dtype=dtype)

        # Create the matrix region
        mr = MatrixRegion(matrix,
                          prepend_n_rows=prepend_n_rows,
                          prepend_n_columns=prepend_n_cols,
                          sliced_dimension=sliced_dimension)

        # Get the partitioned matrix
        if sliced_dimension is None:
            slices = slice(None)
        else:
            slices = (tuple(slice(None) for _ in range(sliced_dimension)) +
                      (partition, ) + tuple(
                          slice(None)
                          for _ in range(sliced_dimension + 1, matrix.ndim)))

        # Check the size is correct
        assert (mr.sizeof(partition) == n_prepend_bytes +
                matrix[slices].nbytes)