code: def test_get_parent_paths(sep):
      if sep is None:
          gpp = get_parent_paths
      else:
          from functools import partial
  
          gpp = partial(get_parent_paths, sep=sep)
  
      # sanity/border checks
      eq_(gpp([], []), [])
      eq_(gpp([], ["a"]), [])
      eq_(gpp(["a"], ["a"]), ["a"])
  
      # Helper to provide testing across different seps and platforms while
      # specifying only POSIX paths here in the test
      def _p(path):
          if sep is None:
              return path
          else:
              return path.replace("/", sep)
  
      _pp = lambda paths: list(map(_p, paths))
  
      # no absolute paths anywhere
      if on_windows:
          assert_raises(ValueError, gpp, "C:\\a", ["a"])
          assert_raises(ValueError, gpp, ["a"], "C:\\a")
      elif sep != "\\":  # \ does not make it absolute
          assert_raises(ValueError, gpp, _p("/a"), ["a"])
          assert_raises(ValueError, gpp, ["a"], [_p("/a")])
      assert_raises(ValueError, gpp, [_p("a//a")], ["a"])
      # dups the actual code but there is no other way AFAIK
      asep = {"/": "\\", None: "\\", "\\": "/"}[sep]
      assert_raises(ValueError, gpp, [f"a{asep}a"], ["a"])
  
      paths = _pp(["a", "a/b", "a/b/file", "c", "d/sub/123"])
  
      eq_(gpp(paths, []), paths)
      eq_(gpp(paths, [], True), [])
  
      # actually a tricky one!  we should check in descending lengths etc
      eq_(gpp(paths, paths), paths)
      # every path is also its own parent
      eq_(gpp(paths, paths, True), paths)
  
      # subdatasets not for every path -- multiple paths hitting the same parent,
      # and we will be getting only a single entry
      # to mimic how git ls-tree operates
      eq_(gpp(paths, ["a"]), ["a", "c", _p("d/sub/123")])
      eq_(gpp(paths, ["a"], True), ["a"])
  
      # and we get the deepest parent
      eq_(
          gpp(_pp(["a/b/file", "a/b/file2"]), _pp(["a", "a/b"])),
          _pp(["a/b"]),
      )
  
file_path: datalad/datalad/support/tests/test_path.py
imports: import os
  from pathlib import PurePosixPath
  from ...tests.utils_pytest import SkipTest, assert_raises, eq_, with_tempfile
  from ...utils import chpwd, on_windows, rmtree
  from ..path import abspath, curdir, get_parent_paths, get_filtered_paths_, robust_abspath, split_ext
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_parent_paths(sep) and returns: path, path