UseCases.FileSysObjects.branches.searchHookSliceForSideBranchStr package

Submodules

UseCases.FileSysObjects.branches.searchHookSliceForSideBranchStr.CallCase module

Create a plist, find multi-node hooks for side branches in PATH strings.

E.g. the branch ‘c/a/new/branch’, which maps the slice ‘c/a’ and extends at ‘a/’
testdata.mypath+/examples/a/b0/c/a/b0/c
________________________________c/a/    
____________________________________`--new/branch
resulting in:
testdata.mypath+'/examples/a/b0/c/a/new/branch'
  • Data:

    see 'testdata.examples'
    

    refer also to the manual [filesystem-elements-as-objects]

  • Call:

    # 1. search and create a path for a side branch
    sp = os.path.normpath('c/a/new/branch')
    rp = getTopFromPathString(sp,self._plist)
    
    # 2. search and create a path for a side branch - use the second plist entry 
    sp = os.path.normpath('b0/c/new/branch')
    rp = getTopFromPathString(sp,self._plist,**{'matchidx':1})
    
    # 3. search and create a path for a side branch - use the second plist entry + reverse the order        
    sp = os.path.normpath('b0/c/new/branch')
    rp = getTopFromPathString(sp,self._plist,**{'matchidx':1,'reverse':True,})
    
    # 4. search and create a path for a side branch - match a path entry with and use the second match within a path entry        
    sp = os.path.normpath('b0/c/new/branch')
    rp = getTopFromPathString(sp,self._plist,**{'matchlvl':1,})
    
    # 5. search and create a path for a side branch UPWARD - match a path entry with and use the second match within a path entry        
    sp = os.path.normpath('b0/c/new/branch')
    rp = getTopFromPathString(sp,self._plist,**{'matchlvlupward':1,})
    
  • Result:

    1. expected = os.path.normpath(testdata.mypath+'/examples/a/b0/c/a/new/branch')
    2. expected = os.path.normpath(testdata.mypath+'/examples/a/b0/c/a/b0/c/new/branch')
    3. expected = os.path.normpath(testdata.mypath+'/examples/a/b0/c/new/branch')
    4. expected = os.path.normpath(testdata.mypath+'/examples/a/b0/c/a/b0/c/new/branch')
    5. expected = os.path.normpath(testdata.mypath+'/examples/a/b0/c/new/branch')
    
class UseCases.FileSysObjects.branches.searchHookSliceForSideBranchStr.CallCase.UseCase(*args, **kargs)[source]

Bases: unittest.case.TestCase

testCase003()[source]
  1. search and create a path for a side branch - use the second plist entry + reverse the order
testCase004()[source]
  1. search and create a path for a side branch - match a path entry with and use the second match within a path entry
testCase005()[source]
  1. search and create a path for a side branch UPWARD - match a path entry with and use the second match within a path entry

Module contents