Source code for UseCases.FileSysObjects.AppPathSyntax.API_options.ias.ias_false.CallCase

"""Demonstrates the application of hierarchical search paths on Microsoft-Windows(TM) on drives . 

Type: LFSYS, LDFSYS 

"""
from __future__ import absolute_import

import unittest
import os,sys

from pysourceinfo.PySourceInfo import getPythonPathRel
from filesysobjects.FileSysObjects import setUpperTreeSearchPath,splitAppPrefix,getAppPrefixLocalPath,getTopFromPathString


#
#######################
#
[docs]class UseCase(unittest.TestCase):
[docs] def testCase_IAS_True(self): _s = sys.path[:] start0 = os.path.abspath(os.path.dirname(__file__)+os.sep+os.path.normpath('/a/b/c')) d,p = os.path.splitdrive(start0) #@UnusedVariable start1 = os.sep + p #@UnusedVariable # normalize _start_elems = splitAppPrefix(start0,**{'ias':True}) start= getAppPrefixLocalPath(_start_elems) assert start0 == start top = 'AppPathSyntax/' _top_elems = ('IAS', '', '', top,) _res = [] ret = setUpperTreeSearchPath(start,top,_res) #@UnusedVariable myplist = [getTopFromPathString('AppPathSyntax',[start])] res = [] for i in range(len(_res)): res.append(getPythonPathRel(_res[i],myplist)) resx = [ 'API_options/ias/ias_false/a/b/c', 'API_options/ias/ias_false/a/b', 'API_options/ias/ias_false/a', 'API_options/ias/ias_false', 'API_options/ias', 'API_options', '.' ] resx = map(os.path.normpath,resx) [ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable sys.path.extend(_s) assert resx == res pass
if __name__ == '__main__': unittest.main()