当前位置: 首页>>代码示例>>Python>>正文


Python PySourceInfo_check_tests.check_callback方法代码示例

本文整理汇总了Python中PySourceInfo_check_tests.check_callback方法的典型用法代码示例。如果您正苦于以下问题:Python PySourceInfo_check_tests.check_callback方法的具体用法?Python PySourceInfo_check_tests.check_callback怎么用?Python PySourceInfo_check_tests.check_callback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySourceInfo_check_tests的用法示例。


在下文中一共展示了PySourceInfo_check_tests.check_callback方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testCase003

# 需要导入模块: import PySourceInfo_check_tests [as 别名]
# 或者: from PySourceInfo_check_tests import check_callback [as 别名]
    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,代码行数:27,代码来源:CallCase.py

示例2: testCase002

# 需要导入模块: import PySourceInfo_check_tests [as 别名]
# 或者: from PySourceInfo_check_tests import check_callback [as 别名]
    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,代码行数:31,代码来源:CallCase.py

示例3: testCase001

# 需要导入模块: import PySourceInfo_check_tests [as 别名]
# 或者: from PySourceInfo_check_tests import check_callback [as 别名]
    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,代码行数:27,代码来源:CallCase.py

示例4: testCase000

# 需要导入模块: import PySourceInfo_check_tests [as 别名]
# 或者: from PySourceInfo_check_tests import check_callback [as 别名]
    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,代码行数:14,代码来源:CallCase.py


注:本文中的PySourceInfo_check_tests.check_callback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。