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 visitdir(self, path):
        """Similar to matcher.visitdir"""
        path = normalizerootdir(path, "visitdir")
        if self.matchrecursive:
            return "all"
        elif self.unsurerecursive:
            return True
        elif path == "":
            return True

        if self._kindpats and self._compiledpats(path):
            # XXX: This is incorrect. But re patterns are already used in
            # production. We should kill them!
            # Need to test "if every string starting with 'path' matches".
            # Obviously it's impossible to test *every* string with the
            # standard regex API, therefore pick a random strange path to test
            # it approximately.
            if self._compiledpats("%s/*/_/-/0/*" % path):
                return "all"
            else:
                return True

        if self._globdirpats and self._compileddirpats(path):
            return True

        subdir, rest = self._split(path)
        subtree = self.get(subdir)
        if subtree is None:
            return False
        else:
            return subtree.visitdir(rest)