code: def test_globbedpaths_get_sub_patterns():
      gp = GlobbedPaths([], "doesn't matter")
      for pat, expected in [
          # If there are no patterns in the directory component, we get no
          # sub-patterns.
          ("", []),
          ("nodir", []),
          (op.join("nomagic", "path"), []),
          (op.join("nomagic", "path*"), []),
          # Create sub-patterns from leading path, successively dropping the
          # right-most component.
          (op.join("s*", "path"), ["s*" + op.sep]),
          (op.join("s", "ss*", "path"), [op.join("s", "ss*") + op.sep]),
          (
              op.join("s", "ss*", "path*"),
              [op.join("s", "ss*") + op.sep],
          ),
          (op.join("s", "ss*" + op.sep), []),
          (
              op.join("s*", "ss", "path*"),
              [op.join("s*", "ss") + op.sep, "s*" + op.sep],
          ),
          (
              op.join("s?", "ss", "sss*", "path*"),
              [
                  op.join("s?", "ss", "sss*") + op.sep,
                  op.join("s?", "ss") + op.sep,
                  "s?" + op.sep,
              ],
          ),
      ]:
          eq_(gp._get_sub_patterns(pat), expected)
  
file_path: datalad/datalad/support/tests/test_globbedpaths.py
imports: import logging
  import os.path
  from itertools import product
  from unittest.mock import patch
  from datalad.tests.utils_pytest import OBSCURE_FILENAME, assert_in, eq_, swallow_logs, with_tree
  from ..globbedpaths import GlobbedPaths
label_desc: Use image node_id 1 for calling a global function with example usage: test_globbedpaths_get_sub_patterns() without return types