code: def test_where_to_scope():
      @_where_to_scope
      def f(scope=None):
          return scope
  
      # others aren't affected but we map where to scope
      assert_equal(f(where="local"), "local")
      assert_equal(f(scope="local"), "local")
      # we do mapping to 'branch' for where
      assert_equal(f(where="dataset"), "branch")
      # but not for 'scope' -- since that is the target new name, we pass as is
      assert_equal(f(scope="dataset"), "dataset")
      # we do not allow both
      assert_raises(ValueError, f, where="local", scope="local")
  
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 18 for calling a global function with example usage: test_where_to_scope() and returns: scope