code: def test_symlinked_dataset_properties(
      repo1=None, repo2=None, repo3=None, non_repo=None, symlink=None
  ):
      ds = Dataset(repo1).create()
  
      # now, let ds be a symlink and change that symlink to point to different
      # things:
      ar2 = AnnexRepo(repo2)
      ar3 = AnnexRepo(repo3)
      assert_true(os.path.isabs(non_repo))
  
      os.symlink(repo1, symlink)
      ds_link = Dataset(symlink)
      assert_is(ds_link.repo, ds.repo)  # same Repo instance
      assert_is_not(ds_link, ds)  # but not the same Dataset instance
      assert_is(ds_link.config, ds.repo.config)
      assert_true(ds_link._cfg_bound)
      assert_is_not_none(ds_link.id)
      # same id, although different Dataset instance:
      assert_equal(ds_link.id, ds.id)
  
      os.unlink(symlink)
      os.symlink(repo2, symlink)
  
      assert_is(ds_link.repo, ar2)  # same Repo instance
      assert_is(ds_link.config, ar2.config)
      assert_true(ds_link._cfg_bound)
      # id is None again, since this repository is an annex but there was no
      # Dataset.create() called yet.
      assert_is_none(ds_link.id)
  
      os.unlink(symlink)
      os.symlink(repo3, symlink)
  
      assert_is(ds_link.repo, ar3)  # same Repo instance
      assert_is(ds_link.config, ar3.config)
      assert_true(ds_link._cfg_bound)
      # id is None again, since this repository is an annex but there was no
      # Dataset.create() called yet.
      assert_is_none(ds_link.id)
  
      os.unlink(symlink)
      os.symlink(non_repo, symlink)
  
      assert_is_none(ds_link.repo)
      assert_is_not(ds_link.config, ar3.config)
      assert_false(ds_link._cfg_bound)
      assert_is_none(ds_link.id)
  
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 11 for calling a global function with example usage: test_symlinked_dataset_properties(repo1, repo2, repo3, non_repo, symlink) without return types