code: def test_dataset_local_mode(path=None):
      ds = create(path)
      # any sensible (and also our CI) test environment(s) should have this
      assert_in("user.name", ds.config)
      # from .datalad/config
      assert_in("datalad.dataset.id", ds.config)
      # from .git/config
      assert_in("annex.version", ds.config)
      # now check that dataset-local mode doesn't have the global piece
      cfg = ConfigManager(ds, source="branch-local")
      assert_not_in("user.name", cfg)
      assert_in("datalad.dataset.id", cfg)
      assert_in("annex.version", cfg)
  
imports: import logging
  import os
  from os.path import exists
  from os.path import join
  from unittest.mock import patch
  import pytest
  from datalad import cfg
  from datalad.api import create
  from datalad.cmd import CommandError
  from datalad.config import ConfigManager, _where_to_scope, parse_gitconfig_dump, rewrite_url, write_config_section
  from datalad.distribution.dataset import Dataset
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.gitrepo import GitRepo
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, assert_equal, assert_false, assert_in, assert_not_equal, assert_not_in, assert_raises, assert_true, chpwd, ok_file_has_content, with_tempfile, with_testsui, with_tree
  from datalad.utils import Path, get_home_envvars, swallow_logs
label_desc: Use image node_id 12 for calling a global function with example usage: test_dataset_local_mode(path) without return types