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


Python testmod.func方法代码示例

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


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

示例1: test_loop_caller_importing

# 需要导入模块: from test.tracedmodules import testmod [as 别名]
# 或者: from test.tracedmodules.testmod import func [as 别名]
def test_loop_caller_importing(self):
        self.tracer.runfunc(traced_func_importing_caller, 1)

        expected = {
            ((os.path.splitext(trace.__file__)[0] + '.py', 'trace', 'Trace.runfunc'),
                (self.filemod + ('traced_func_importing_caller',))): 1,
            ((self.filemod + ('traced_func_simple_caller',)),
                (self.filemod + ('traced_func_linear',))): 1,
            ((self.filemod + ('traced_func_importing_caller',)),
                (self.filemod + ('traced_func_simple_caller',))): 1,
            ((self.filemod + ('traced_func_importing_caller',)),
                (self.filemod + ('traced_func_importing',))): 1,
            ((self.filemod + ('traced_func_importing',)),
                (fix_ext_py(testmod.__file__), 'testmod', 'func')): 1,
        }
        self.assertEqual(self.tracer.results().callers, expected)


# Created separately for issue #3821 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:21,代码来源:test_trace.py

示例2: test_issue9936

# 需要导入模块: from test.tracedmodules import testmod [as 别名]
# 或者: from test.tracedmodules.testmod import func [as 别名]
def test_issue9936(self):
        tracer = trace.Trace(trace=0, count=1)
        modname = 'test.tracedmodules.testmod'
        # Ensure that the module is executed in import
        if modname in sys.modules:
            del sys.modules[modname]
        cmd = ("import test.tracedmodules.testmod as t;"
               "t.func(0); t.func2();")
        with captured_stdout() as stdout:
            self._coverage(tracer, cmd)
        stdout.seek(0)
        stdout.readline()
        coverage = {}
        for line in stdout:
            lines, cov, module = line.split()[:3]
            coverage[module] = (int(lines), int(cov[:-1]))
        # XXX This is needed to run regrtest.py as a script
        modname = trace.fullmodname(sys.modules[modname].__file__)
        self.assertIn(modname, coverage)
        self.assertEqual(coverage[modname], (5, 100)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:22,代码来源:test_trace.py

示例3: test_issue9936

# 需要导入模块: from test.tracedmodules import testmod [as 别名]
# 或者: from test.tracedmodules.testmod import func [as 别名]
def test_issue9936(self):
        tracer = trace.Trace(trace=0, count=1)
        modname = 'test.tracedmodules.testmod'
        # Ensure that the module is executed in import
        if modname in sys.modules:
            del sys.modules[modname]
        cmd = ("import test.tracedmodules.testmod as t;"
               "t.func(0); t.func2();")
        with captured_stdout() as stdout:
            self._coverage(tracer, cmd)
        stdout.seek(0)
        stdout.readline()
        coverage = {}
        for line in stdout:
            lines, cov, module = line.split()[:3]
            coverage[module] = (int(lines), int(cov[:-1]))
        # XXX This is needed to run regrtest.py as a script
        modname = trace._fullmodname(sys.modules[modname].__file__)
        self.assertIn(modname, coverage)
        self.assertEqual(coverage[modname], (5, 100))

### Tests that don't mess with sys.settrace and can be traced
### themselves TODO: Skip tests that do mess with sys.settrace when
### regrtest is invoked with -T option. 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:26,代码来源:test_trace.py

示例4: get_firstlineno

# 需要导入模块: from test.tracedmodules import testmod [as 别名]
# 或者: from test.tracedmodules.testmod import func [as 别名]
def get_firstlineno(func):
    return func.__code__.co_firstlineno

#-------------------- Target functions for tracing ---------------------------#
#
# The relative line numbers of lines in these functions matter for verifying
# tracing. Please modify the appropriate tests if you change one of the
# functions. Absolute line numbers don't matter.
# 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:test_trace.py

示例5: traced_func_importing

# 需要导入模块: from test.tracedmodules import testmod [as 别名]
# 或者: from test.tracedmodules.testmod import func [as 别名]
def traced_func_importing(x, y):
    return x + y + testmod.func(1) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:4,代码来源:test_trace.py


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