code: def test_resolve_path(path=None):
      if str(Path(path).resolve()) != path:
          raise SkipTest(
              "Test assumptions require non-symlinked parent paths"
          )
      # initially ran into on OSX https://github.com/datalad/datalad/issues/2406
      opath = op.join(path, "origin")
      os.makedirs(opath)
      if not on_windows:
          lpath = op.join(path, "linked")
          os.symlink("origin", lpath)
  
      ds_global = Dataset(path)
      # path resolution of absolute paths is not influenced by symlinks
      # ignore the linked path on windows, it is not a symlink in the POSIX sense
      for d in (opath,) if on_windows else (opath, lpath):
          ds_local = Dataset(d)
          # no symlink resolution
          eq_(str(resolve_path(d)), d)
          # list comes out as a list
          eq_(resolve_path([d]), [Path(d)])
          # multiple OK
          eq_(resolve_path([d, d]), [Path(d), Path(d)])
  
          with chpwd(d):
              # be aware: knows about cwd, but this CWD has symlinks resolved
              eq_(str(resolve_path(d).cwd()), opath)
              # using pathlib's `resolve()` will resolve any
              # symlinks
              # also resolve `opath`, as on old windows systems the path might
              # come in crippled (e.g. C:\Users\MIKE~1/...)
              # and comparison would fails unjustified
              eq_(resolve_path(".").resolve(), ut.Path(opath).resolve())
              # no norming, but absolute paths, without resolving links
              eq_(resolve_path("."), ut.Path(d))
              eq_(str(resolve_path(".")), d)
  
              # there is no concept of an "explicit" relative path anymore
              # relative is relative, regardless of the specific syntax
              eq_(
                  resolve_path(op.join(os.curdir, "bu"), ds=ds_global),
                  ds_global.pathobj / "bu",
              )
              # there is no full normpath-ing or other funky resolution of
              # parent directory back-reference
              eq_(
                  str(
                      resolve_path(
                          op.join(os.pardir, "bu"), ds=ds_global
                      )
                  ),
                  op.join(ds_global.path, os.pardir, "bu"),
              )
  
          # resolve against a dataset given as a path/str
          # (cmdline input scenario)
          eq_(resolve_path("bu", ds=ds_local.path), Path.cwd() / "bu")
          eq_(resolve_path("bu", ds=ds_global.path), Path.cwd() / "bu")
          # resolve against a dataset given as a dataset instance
          # (object method scenario)
          eq_(resolve_path("bu", ds=ds_local), ds_local.pathobj / "bu")
          eq_(
              resolve_path("bu", ds=ds_global), ds_global.pathobj / "bu"
          )
          # not being inside a dataset doesn't change the resolution result
          eq_(
              resolve_path(op.join(os.curdir, "bu"), ds=ds_global),
              ds_global.pathobj / "bu",
          )
          eq_(
              str(resolve_path(op.join(os.pardir, "bu"), ds=ds_global)),
              op.join(ds_global.path, os.pardir, "bu"),
          )
  
imports: import os
  import os.path
  from os.path import abspath
  from os.path import join
  from os.path import lexists, relpath
  import pytest
  import datalad.utils
  from datalad import cfg
  from datalad.api import clone, create, get
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import NoDatasetFound
  from datalad.support.gitrepo import GitRepo
  from datalad.tests.utils_pytest import OBSCURE_FILENAME, SkipTest, assert_equal, assert_false, assert_is, assert_is_instance, assert_is_none, assert_is_not, assert_is_not_none, assert_not_equal, assert_not_in, assert_raises, assert_repo_status, assert_result_count, assert_true, eq_, known_failure_windows, ok_, swallow_logs, with_tempfile
  from datalad.utils import Path, _path_, chpwd, on_windows, rmtree
  from ..dataset import Dataset, EnsureDataset, require_dataset, resolve_path
label_desc: Use image node_id 12 for calling a global function with example usage: test_resolve_path(path) without return types