code: def test_refuse_to_drop_cwd(path=None):
      ds = Dataset(path).create()
      (ds.pathobj / "deep" / "down").mkdir(parents=True)
      for p in (
          ds.pathobj,
          ds.pathobj / "deep",
          ds.pathobj / "deep" / "down",
      ):
          with chpwd(str(p)):
              # will never remove PWD, or anything outside the dataset
              for target in (
                  ds.pathobj,
                  os.curdir,
                  os.pardir,
                  op.join(os.pardir, os.pardir),
              ):
                  assert_raises(
                      RuntimeError, drop, path=target, what="all"
                  )
      sub = ds.create("sub")
      subsub = sub.create("subsub")
      for p in (sub.path, subsub.path):
          with chpwd(p):
              assert_raises(RuntimeError, drop, what="all")
  
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 9 for calling a global function with example usage: test_refuse_to_drop_cwd(path) without return types