def test_deepcopy_subset(adata, spmat: type):
    adata.obsp["arr"] = np.zeros((adata.n_obs, adata.n_obs))
    adata.obsp["spmat"] = spmat((adata.n_obs, adata.n_obs))

    adata = deepcopy(adata[:10].copy())

    assert isinstance(adata.obsp["arr"], np.ndarray)
    assert not isinstance(adata.obsp["arr"], ArrayView)
    np.testing.assert_array_equal(adata.obsp["arr"].shape, (10, 10))

    assert isinstance(adata.obsp["spmat"], spmat)
    assert not isinstance(
        adata.obsp["spmat"],
        SparseCSRView if spmat is sparse.csr_matrix else SparseCSCView,
    )
    np.testing.assert_array_equal(adata.obsp["spmat"].shape, (10, 10))
def _setup_drag(self, item):
    self._drag_and_drop_context.setup_drag(
      # Using the entire item allows dragging only by the label rather than the
      # widget itself. This avoids problems with widgets such as spin buttons
      # that do not behave correctly when reordering and also avoids accidental
      # clicking and modifying the widget by the user.
      item.widget,
      self._get_drag_data,
      self._on_drag_data_received,
      [item],
      [item],
      self)