code: def test_drop_file_content(path=None, outside_path=None):
      # see docstring for test data structure
      ds = get_deeply_nested_structure(path)
      axfile_rootds = op.join("subdir", "annexed_file.txt")
      axfile_subds = op.join(
          "subds_modified", "subdir", "annexed_file.txt"
      )
      gitfile = op.join("subdir", "git_file.txt")
  
      # refuse to operate on non-ds paths
      assert_in_results(
          ds.drop(outside_path, on_failure="ignore"),
          status="error",
          message=("path not underneath the reference dataset %s", ds),
      )
      # we only have a single copy of annexed files right now
      # check that it is not dropped by default
      with assert_raises(IncompleteResultsError) as cme:
          ds.drop(axfile_rootds)
      # The --force suggestion from git-annex-drop is translated to --reckless.
      assert_in("--reckless", str(cme.value))
  
      # error on non-existing paths
      non_existant_relpaths = [
          "funky",
          op.join("subds_modified", "subfunky"),
      ]
      res = ds.drop(non_existant_relpaths, on_failure="ignore")
      # only two results, one per file
      assert_result_count(res, len(non_existant_relpaths))
      for rp in non_existant_relpaths:
          assert_in_results(
              res,
              type="file",
              status="error",
              action="drop",
              error_message="File unknown to git",
              path=str(ds.pathobj / rp),
              refds=ds.path,
          )
  
      # drop multiple files from different datasets
      ok_(ds.repo.file_has_content(axfile_rootds))
      res = ds.drop(
          [axfile_rootds, axfile_subds],
          reckless="availability",
          jobs=2,
          on_failure="ignore",
      )
      nok_(ds.repo.file_has_content(axfile_rootds))
      assert_result_count(res, 2)
      for rp in [axfile_rootds, axfile_subds]:
          assert_in_results(
              res,
              type="file",
              status="ok",
              action="drop",
              path=str(ds.pathobj / rp),
              refds=ds.path,
          )
  
      # dropping file content for files in git
      res = ds.drop(gitfile, on_failure="ignore")
      assert_result_count(res, 1)
      assert_in_results(
          res,
          type="file",
          # why is this 'notneeded' and not 'impossible'
          # if the latter, any operation on any dataset with a
          # single file in git would fail
          status="notneeded",
          action="drop",
          message="no annex'ed content",
          path=str(ds.pathobj / gitfile),
          refds=ds.path,
      )
  
      # modified files, we cannot drop their content
      modfile = ds.pathobj / axfile_rootds
      modfile.unlink()
      modfile.write_text("new content")
      res = ds.drop(modfile, on_failure="ignore")
      assert_in_results(
          res,
          status="impossible",
          action="drop",
          message="cannot drop modified content, save first",
          path=str(modfile),
          refds=ds.path,
      )
  
      # detection of untracked content
      untrackeddir = (
          ds.pathobj
          / "subds_modified"
          / "subds_lvl1_modified"
          / f"{OBSCURE_FILENAME}_directory_untracked"
      )
      res = ds.drop(untrackeddir, on_failure="ignore")
      assert_in_results(
          res,
          status="impossible",
          action="drop",
          message="cannot drop untracked content, save first",
          path=str(untrackeddir),
          type="directory",
          refds=ds.path,
      )
  
      # and lastly, recursive drop
      res = ds.drop(recursive=True, on_failure="ignore")
      # there is not much to test here (we already dropped the only
      # annexed files above). however, we should see results from the top
      # ds, and the most-bottom ds
      # subdatasets
      for p in [ds.pathobj / "subdir" / "file_modified", untrackeddir]:
          assert_in_results(res, path=str(p))
  
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 1 for calling a global function with example usage: test_drop_file_content(path, outside_path) without return types