當前位置: 首頁>>代碼示例>>Python>>正文


Python PySourceInfo_check_tests類代碼示例

本文整理匯總了Python中PySourceInfo_check_tests的典型用法代碼示例。如果您正苦於以下問題:Python PySourceInfo_check_tests類的具體用法?Python PySourceInfo_check_tests怎麽用?Python PySourceInfo_check_tests使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PySourceInfo_check_tests類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testCase003

    def testCase003(self):
        import sys
        _s=sys.path[:]
        sys.path.insert(0,os.path.dirname(__file__)+os.sep+'..')
        import PySourceInfo_check_tests #@UnresolvedImport
        
        version = '{0}.{1}'.format(*sys.version_info[:2])
        if version == '2.6': # pragma: no cover
            b = os.path.basename(unittest.__file__)[:-4]
            a = PySourceInfo_check_tests.check_callback(pysourceinfo.PySourceInfo.getCallerModuleName,3)
        elif version == '2.7': # pragma: no cover
            fpn = os.path.dirname(unittest.__file__)
            fpn = os.path.basename(fpn)
            fx = PySourceInfo_check_tests.check_callback(pysourceinfo.PySourceInfo.getCallerModulePythonPath,3)
            a = os.path.normpath(fx+os.sep+fpn)
            b = os.path.normpath(os.path.dirname(unittest.__file__))
        else:
            assert False



        [ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
        sys.path.extend(_s)

        assert a == b 
開發者ID:ArnoCan,項目名稱:pysourceinfo,代碼行數:25,代碼來源:CallCase.py

示例2: testCase002

    def testCase002(self):
        import sys
        _s=sys.path[:]
        _sx = repr(sys.path)
        sys.path.insert(0,os.path.dirname(__file__)+os.sep+'..')
        import PySourceInfo_check_tests #@UnresolvedImport
        
        fx0 = os.path.dirname(PySourceInfo_check_tests.__file__)+os.sep+".."+os.sep+".."+os.sep+".."
        fx1 = os.path.dirname(PySourceInfo_check_tests.__file__)+os.sep+".."+os.sep+".."
        fx2 = os.path.dirname(pysourceinfo.__file__)+os.sep+".."
        fx = PySourceInfo_check_tests.check_callback(pysourceinfo.PySourceInfo.getCallerPackagePythonPath,2)

        fx0 = os.path.abspath(fx0)
        fx1 = os.path.abspath(fx1)
        fx2 = os.path.abspath(fx2)
        fx = os.path.abspath(fx)
        fx0 = os.path.normpath(fx0)
        fx1 = os.path.normpath(fx1)
        fx2 = os.path.normpath(fx2)
        fx = os.path.normpath(fx)
        
        assert fx == fx0 or fx == fx1
        
        assert _sx != repr(sys.path)
        sys.path.pop(0)
        assert _sx == repr(sys.path)

        [ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
        sys.path.extend(_s)
開發者ID:ArnoCan,項目名稱:pysourceinfo,代碼行數:29,代碼來源:CallCase.py

示例3: testCase001

    def testCase001(self):
        import sys
        _s=sys.path[:]
        sys.path.insert(0,os.path.dirname(__file__)+os.sep+'..')
        import PySourceInfo_check_tests #@UnresolvedImport

        fx0 = "PySourceInfo_check_tests.py"
        fx1 = "tests/30_libs/040_PySourceInfo/PySourceInfo_check_tests.py"
        
        fx = PySourceInfo_check_tests.check_callback(pysourceinfo.PySourceInfo.getCallerModuleFilePathName,1)
        
        fx0 = os.path.normpath(fx0)
        fx = os.path.normpath(fx)

        fx0 = os.path.normpath(fx0)
        fx1 = os.path.normpath(fx1)
        fx = os.path.abspath(fx)
        fx = os.path.normpath(fx)

        fx = pysourceinfo.PySourceInfo.getPythonPathRel(fx)

        assert fx == fx0 or fx == fx1

        [ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
        sys.path.extend(_s)
開發者ID:ArnoCan,項目名稱:pysourceinfo,代碼行數:25,代碼來源:CallCase.py

示例4: testCase000

    def testCase000(self):
        import sys
        _s=sys.path[:]
        sys.path.insert(0,os.path.dirname(__file__)+os.sep+'..')
        import PySourceInfo_check_tests #@UnresolvedImport

        fpn = pysourceinfo.PySourceInfo.getModulePathName(pysourceinfo.PySourceInfo)
        fx = PySourceInfo_check_tests.check_callback(pysourceinfo.PySourceInfo.getCallerPathName,0)
        assert os.path.normpath(fx) == fpn

        [ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
        sys.path.extend(_s)
開發者ID:ArnoCan,項目名稱:pysourceinfo,代碼行數:12,代碼來源:CallCase.py


注:本文中的PySourceInfo_check_tests類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。