UseCases.FileSysObjects.addAndRemoveEntries package

Submodules

UseCases.FileSysObjects.addAndRemoveEntries.CallCase module

Create a plist, find a matching relative filepathname in directory tree.

Calling elementary functions.

  • Data:

    see 'testdata.examples'
    

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

  • Call:

    import testdata
    import filesysobjects.FileSysObjects
      
    # start of upward search - file is converted into it's containing directory node
    s = os.sep
    any_sub_path = os.path.normpath('examples/a/b0/c/a/b0/c/F')
    spath  = testdata.mypath
    spath += any_sub_path
    
    # Here an empty list is used for search only. The function adds 
    # entries to the provided list storage, thus e.g. to 'sys.path' too.
    _plist = []
    
    # 0. build a search path list - if not yet available
    #    adds each directory from spath to its matching 
    #    subnode  "a/b"
    #
    setUpperTreeSearchPath(spath,os.path.normpath('b/B.txt'), _plist)
    rp = findRelPathInSearchPath(spath,_plist)
    
    
    _addp = _plist_ref[-1]
    
    # 1. append an item       
    _px = addPathToSearchPath(_addp, _plist,**{'append':True})
    
    # 2. remove the item
    delPathFromSearchPath(_addp, _plist)
    
  • Result:

    expected = os.path.normpath(testdata.mypath+'/examples/a/b0/c/a/b0/F1')
    
class UseCases.FileSysObjects.addAndRemoveEntries.CallCase.UseCase(*args, **kargs)[source]

Bases: unittest.case.TestCase

test_UseCase000_append()[source]
  1. append an item
test_UseCase010_prepend_same_again()[source]
  1. append same item again - with success
test_UseCase020_append_try_same_again_nonredundant()[source]
  1. try to add same item again - with failure
test_UseCase021_append_try_same_again_nonredundant()[source]
  1. try to add same item again - with failure
test_UseCase030_prepend_same_again_checkreal()[source]
  1. prepend same item again - with checkreal
test_UseCase040_delete_same()[source]
  1. remove the item

Module contents