def test_set_subset_obsm(adata, subset_func):
    init_hash = joblib.hash(adata)
    orig_obsm_val = adata.obsm["o"].copy()

    while True:
        subset_idx = slice_subset(adata.obs_names)
        if len(adata[subset_idx, :]) > 2:
            break
    subset = adata[subset_idx, :]

    internal_idx = _normalize_index(
        subset_func(np.arange(subset.obsm["o"].shape[0])), subset.obs_names
    )

    assert subset.is_view
    subset.obsm["o"][internal_idx] = 1
    assert not subset.is_view
    assert np.all(adata.obsm["o"] == orig_obsm_val)

    assert init_hash == joblib.hash(adata)
def _execute_rpc_implementor_background(self, context, audit_name, target,
                                           response_queue, args, kwargs):
        """
        Honor a remote procedure call request from a plugin,
        from a background thread. Must only be used as the entry
        point for said background thread!

        :param context: Plugin execution context.
        :type context: PluginContext

        :param audit_name: Name of the audit requesting the call.
        :type audit_name: str

        :param target: RPC implementor function.
        :type target: callable

        :param response_queue: Response queue identity.
        :type response_queue: str

        :param args: Positional arguments to the call.
        :type args: tuple

        :param kwargs: Keyword arguments to the call.
        :type kwargs: dict
        """
        Config._context = context
        self.execute_rpc_implementor(
            audit_name, target, response_queue, args, kwargs)