code: def test_get_local_file_url():
      compat_annex = "git-annex"
      compat_git = "git"
      for path, url, compatibility in (
          # relpaths are special-cased below
          ("test.txt", "test.txt", compat_annex),
          (OBSCURE_FILENAME, urlquote(OBSCURE_FILENAME), compat_annex),
      ) + (
          (
              (
                  "C:\\Windows\\notepad.exe",
                  "file://C:/Windows/notepad.exe",
                  compat_annex,
              ),
              (
                  "C:\\Windows\\notepad.exe",
                  "file:///C:/Windows/notepad.exe",
                  compat_git,
              ),
          )
          if on_windows
          else (
              ("/a", "file:///a", compat_annex),
              ("/a/b/c", "file:///a/b/c", compat_annex),
              ("/a~", "file:///a~", compat_annex),
              # there are no files with trailing slashes in the name
              # ('/a b/', 'file:///a%20b/'),
              ("/a b/name", "file:///a%20b/name", compat_annex),
          )
      ):
          # Yarik found no better way to trigger.  .decode() isn't enough
          print("D: %s" % path)
          if isabs(path):
              assert (
                  get_local_file_url(path, compatibility=compatibility)
                  == url
              )
              abs_path = path
          else:
              assert get_local_file_url(
                  path,
                  allow_relative_path=True,
                  compatibility=compatibility,
              ) == "/".join(
                  (
                      get_local_file_url(
                          os.getcwd(), compatibility=compatibility
                      ),
                      url,
                  )
              )
              abs_path = opj(os.getcwd(), path)
          if compatibility == compat_git:
              assert (
                  get_local_file_url(
                      abs_path, compatibility=compatibility
                  )
                  == Path(abs_path).as_uri()
              )
  
imports: import logging
  import os
  import tempfile
  from os.path import isabs
  from os.path import join
  import pytest
  import datalad.support.network
  from datalad.distribution.dataset import Dataset
  from datalad.support.network import RI, SSHRI, URL, DataLadRI, GitTransportRI, PathRI, _split_colon, dlurljoin, get_local_file_url, get_response_disposition_filename, get_tld, get_url_straight_filename, is_datalad_compat_ri, is_ssh, is_url, iso8601_to_epoch, local_path_representation, local_path2url_path, local_url_path_representation, parse_url_opts, quote_path, same_website, urlquote, url_path2local_path
  from datalad.tests.utils_pytest import OBSCURE_FILENAME, SkipTest, assert_in, assert_raises, assert_status, eq_, get_most_obscure_supported_name, known_failure_githubci_win, neq_, nok_, ok_, skip_if, swallow_logs, with_tempfile
  from datalad.utils import Path, PurePosixPath, on_windows
  from ..network import rfc2822_to_epoch
label_desc: Use image node_id 23 for calling a global function with example usage: test_get_local_file_url() without return types