code: def test_undead_annex_detection(
      gitpath=None, origpath=None, clonepath=None
  ):
      gitds = Dataset(gitpath).create(annex=False)
      # a gitrepo can be inspected too, it might just not know anything
      eq_([], _detect_nondead_annex_at_remotes(gitds.repo, "someid"))
  
      origds = Dataset(origpath).create()
      origrepo = origds.repo
      # only the local repo knows about its own annex
      eq_(
          [None],
          _detect_nondead_annex_at_remotes(origrepo, origrepo.uuid),
      )
  
      # works with clones
      cloneds = clone(origds, clonepath)
      clonerepo = cloneds.repo
      # the clone now know two locations, itself and origin
      eq_(
          [None, DEFAULT_REMOTE],
          _detect_nondead_annex_at_remotes(clonerepo, origrepo.uuid),
      )
      # just from cloning the original repo location does not learn
      # about the new annex in the clone
      eq_(
          [], _detect_nondead_annex_at_remotes(origrepo, clonerepo.uuid)
      )
      # it will know after a push
      cloneds.push()
      eq_(
          [None],
          _detect_nondead_annex_at_remotes(origrepo, clonerepo.uuid),
      )
      # we can declare an annex dead (here done at original location)
      origrepo.call_annex(["dead", clonerepo.uuid])
      eq_(
          [], _detect_nondead_annex_at_remotes(origrepo, clonerepo.uuid)
      )
      # again not automatically communicated to clones
      eq_(
          [None, DEFAULT_REMOTE],
          _detect_nondead_annex_at_remotes(clonerepo, clonerepo.uuid),
      )
      # but a fetch will make the death known
      clonerepo.call_git(["fetch"])
      eq_(
          [None],
          _detect_nondead_annex_at_remotes(clonerepo, clonerepo.uuid),
      )
      # after a local git-annex branch synchronization, it is completely
      # "gone"
      clonerepo.localsync()
      eq_(
          [],
          _detect_nondead_annex_at_remotes(clonerepo, clonerepo.uuid),
      )
  
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 3 for calling a global function with example usage: test_undead_annex_detection(gitpath, origpath, clonepath) without return types