code: def test_uninstall_recursive(path=None):
      ds = Dataset(path)
      assert_raises(ValueError, ds.drop)
  
      ds = ds.create()
      subds = ds.create("sub")
  
      # fail to uninstall with subdatasets present
      res = ds.drop(
          what="all", reckless="availability", on_failure="ignore"
      )
      assert_in_results(
          res,
          action="uninstall",
          path=ds.path,
          type="dataset",
          status="error",
          message=(
              "cannot drop dataset, subdataset(s) still present "
              "(forgot --recursive?): %s",
              [subds.path],
          ),
      )
      res = ds.drop(
          what="all",
          reckless="availability",
          recursive=True,
          on_failure="ignore",
      )
      # both datasets gone
      assert_result_count(res, 2)
      assert_result_count(res, 2, type="dataset", status="ok")
      # the subdataset is reported first
      eq_([subds.path, ds.path], [r.get("path") for r in res])
      # no dataset installed anymore
      eq_(ds.is_installed(), False)
      # not even a trace
      eq_(ds.pathobj.exists(), False)
  
imports: import os
  import os.path
  from pathlib import Path
  from unittest.mock import patch
  from datalad.api import Dataset, clone, create, drop
  from datalad.distributed.drop import _detect_nondead_annex_at_remotes, _detect_unpushed_revs
  from datalad.support.exceptions import IncompleteResultsError, NoDatasetFound
  from datalad.support.gitrepo import GitRepo
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, OBSCURE_FILENAME, assert_in, assert_in_results, assert_raises, assert_repo_status, assert_result_count, assert_status, eq_, get_deeply_nested_structure, known_failure_githubci_win, nok_, ok_, with_tempfile
  from datalad.utils import chpwd
label_desc: Use image node_id 4 for calling a global function with example usage: test_uninstall_recursive(path) without return types