code: def test_get_recurse_subdatasets(src=None, path=None):
      _mk_submodule_annex(src, "test-annex.dat", "irrelevant")
  
      ds = clone(
          src, path, result_xfm="datasets", return_type="item-or-list"
      )
  
      # ask for the two subdatasets specifically. This will obtain them,
      # but not any content of any files in them
      subds1, subds2 = ds.get(
          ["subm 1", "2"],
          get_data=False,
          description="youcouldnotmakethisup",
          result_xfm="datasets",
      )
      for d in (subds1, subds2):
          eq_(d.repo.get_description(), "youcouldnotmakethisup")
  
      # there are 3 files to get: test-annex.dat within each dataset:
      rel_path_sub1 = opj(basename(subds1.path), "test-annex.dat")
      rel_path_sub2 = opj(basename(subds2.path), "test-annex.dat")
      annexed_files = {"test-annex.dat", rel_path_sub1, rel_path_sub2}
  
      # None of them is currently present:
      ok_(ds.repo.file_has_content("test-annex.dat") is False)
      ok_(subds1.repo.file_has_content("test-annex.dat") is False)
      ok_(subds2.repo.file_has_content("test-annex.dat") is False)
  
      assert_repo_status(subds1.path)
      # explicitly given path in subdataset => implicit recursion:
      # MIH: Nope, we fulfill the dataset handle, but that doesn't
      #      imply fulfilling all file handles
      result = ds.get(rel_path_sub1, recursive=True)
      # the subdataset was already present
      assert_in_results(
          result, type="dataset", path=subds1.path, status="notneeded"
      )
      # we got the file
      assert_in_results(
          result, path=opj(ds.path, rel_path_sub1), status="ok"
      )
  
      assert_in_results(
          result, path=opj(ds.path, rel_path_sub1), status="ok"
      )
      ok_(subds1.repo.file_has_content("test-annex.dat") is True)
  
      # drop it:
      subds1.repo.drop("test-annex.dat")
      ok_(subds1.repo.file_has_content("test-annex.dat") is False)
  
      # now, with a path not explicitly pointing within a
      # subdataset, but recursive option:
      # get everything:
      result = ds.get(
          recursive=True,
          result_filter=lambda x: x.get("type") != "dataset",
      )
      assert_status("ok", result)
  
      eq_(
          set(
              [
                  item.get("path")[len(ds.path) + 1 :]
                  for item in result
                  if item["type"] == "file"
              ]
          ),
          annexed_files,
      )
      ok_(ds.repo.file_has_content("test-annex.dat") is True)
      ok_(subds1.repo.file_has_content("test-annex.dat") is True)
      ok_(subds2.repo.file_has_content("test-annex.dat") is True)
  
      # drop them:
      ds.repo.drop("test-annex.dat")
      subds1.repo.drop("test-annex.dat")
      subds2.repo.drop("test-annex.dat")
      ok_(ds.repo.file_has_content("test-annex.dat") is False)
      ok_(subds1.repo.file_has_content("test-annex.dat") is False)
      ok_(subds2.repo.file_has_content("test-annex.dat") is False)
  
      # now, the very same call, but without recursive:
      result = ds.get(".", recursive=False)
      assert_status("ok", result)
      # no duplicate reporting on subdataset install and annex-get of its
      # directory
      eq_(len(result), 1)
      assert_result_count(
          result, 1, path=opj(ds.path, "test-annex.dat"), status="ok"
      )
      ok_(ds.repo.file_has_content("test-annex.dat") is True)
      ok_(subds1.repo.file_has_content("test-annex.dat") is False)
      ok_(subds2.repo.file_has_content("test-annex.dat") is False)
  
imports: from os import curdir
  from os.path import basename
  from os.path import join
  from unittest.mock import patch
  import pytest
  from datalad.api import clone, create, get, install
  from datalad.distribution.get import _get_flexible_source_candidates_for_submodule
  from datalad.interface.results import only_matching_paths
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import InsufficientArgumentsError, RemoteNotAvailableError
  from datalad.support.network import get_local_file_url
  from datalad.tests.utils_testdatasets import _make_dataset_hierarchy, _mk_submodule_annex
  from datalad.tests.utils_pytest import create_tree, assert_false, assert_raises, assert_in, assert_status, assert_in_results, assert_not_in_results, assert_repo_status, assert_result_count, assert_message, DEFAULT_REMOTE, eq_, known_failure_windows, known_failure_githubci_win, ok_, serve_path_via_http, skip_if_adjusted_branch, skip_ssh, skip_if_on_windows, slow, with_tempfile, with_tree
  from datalad.utils import Path, chpwd, rmtree, with_pathsep
  from ..dataset import Dataset
label_desc: Use image node_id 7 for calling a global function with example usage: test_get_recurse_subdatasets(src, path) without return types