def test_view_failed_delitem(attr):
    adata = gen_adata((10, 10))
    view = adata[5:7, :][:, :5]
    adata_hash = joblib.hash(adata)
    view_hash = joblib.hash(view)

    with pytest.raises(KeyError):
        getattr(view, attr).__delitem__("not a key")

    assert view.is_view
    assert adata_hash == joblib.hash(adata)
    assert view_hash == joblib.hash(view)
def __getitem__(self, key):
        value = self._collection[key]
        if isinstance(key, slice):
            slice_repr = ":".join(str("" if i is None else i) for i in (key.start, key.stop, key.step))
            logger.debug("Get /%s[%s] config key", "/".join(self._path), slice_repr)
            return [self._to_python(item) for item in value]
        else:
            logger.debug("Get /%s[%s] config key", "/".join(self._path), key)
            return self._to_python(value)