code: def test_get_file_annexinfo(path=None):
      ds = Dataset(path).create(force=True)
      ds.save("ingit.txt", to_git=True)
      ds.save()
      # have some content-less component for testing
      ds.drop(ds.pathobj / "dir1", reckless="kill")
  
      repo = ds.repo
      # only handles a single file at a time
      assert_raises(
          ValueError, repo.get_file_annexinfo, repo.pathobj / "dir2"
      )
      # however, it only functionally matters that there is only a single file to
      # report on not that the exact query path matches, the matching path is in
      # the report
      assert_equal(
          repo.pathobj / "dir1" / "dropped",
          repo.get_file_annexinfo(repo.pathobj / "dir1")["path"],
      )
  
      # does not raise on a non-annex file, instead it returns no properties
      assert_equal(repo.get_file_annexinfo("ingit.txt"), {})
  
      # but does raise on path that doesn exist
      assert_raises(NoSuchPathError, repo.get_file_annexinfo, "nothere")
  
      # check return properties for utility
      props = repo.get_file_annexinfo("inannex.txt")
      # to replace get_file_backend()
      assert_equal(props["backend"], "MD5E")
      # to replace get_file_key()
      assert_equal(
          props["key"], "MD5E-s7--3b158c5b0a18c247ebad28c09fc3e180.txt"
      )
      # for size reporting
      assert_equal(props["bytesize"], 7)
      # all records have a pathobj
      assert_equal(props["path"], repo.pathobj / "inannex.txt")
      # test if `eval_availability` has desired effect
      assert_not_in("has_content", props)
  
      # extended set of properties, after more expensive availability check
      props = repo.get_file_annexinfo(
          "inannex.txt", eval_availability=True
      )
      # to replace file_has_content()
      assert_equal(props["has_content"], True)
      # to replace get_contentlocation()
      assert_equal(Path(props["objloc"]).read_text(), "inannex")
  
      # make sure has_content is not always True
      props = repo.get_file_annexinfo(
          ds.pathobj / "dir1" / "dropped", eval_availability=True
      )
      assert_equal(props["has_content"], False)
      assert_not_in("objloc", props)
  
file_path: datalad/datalad/support/tests/test_fileinfo.py
imports: import os.path
  from pathlib import Path
  import datalad.utils
  from datalad.distribution.dataset import Dataset
  from datalad.support.exceptions import NoSuchPathError
  from datalad.support.gitrepo import GitRepo
  from datalad.tests.utils_pytest import assert_dict_equal, assert_equal, assert_false, assert_in, assert_not_in, assert_raises, assert_repo_status, get_annexstatus, get_convoluted_situation, known_failure_githubci_win, on_nfs, on_travis, slow, skip_if, with_tempfile, with_tree
label_desc: Use image node_id 10 for calling a global function with example usage: test_get_file_annexinfo(path) without return types