def test_set_var(adata, subset_func):
    init_hash = joblib.hash(adata)

    subset = adata[:, subset_func(adata.var_names)]

    new_var = pd.DataFrame(
        dict(a=np.ones(subset.n_vars), b=np.ones(subset.n_vars)),
        index=subset.var_names,
    )

    assert subset.is_view
    subset.var = new_var
    assert not subset.is_view
    assert np.all(subset.var == new_var)

    assert joblib.hash(adata) == init_hash
def _from_python(self, key, value):
        new_path = self._path + (key,)
        if isinstance(value, dict):
            value = self.custom_classes.get(new_path, ConfigDict)(value, new_path)
        elif isinstance(value, list):
            value = self.custom_classes.get(new_path, ConfigList)(value, new_path)
        elif isinstance(value, str):
            match = self.PROXY_VAR_RE.match(value)
            if match:
                value = self._make_proxy(key, match)
        return value