本文整理汇总了Python中collector.Collector.data_points方法的典型用法代码示例。如果您正苦于以下问题:Python Collector.data_points方法的具体用法?Python Collector.data_points怎么用?Python Collector.data_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collector.Collector
的用法示例。
在下文中一共展示了Collector.data_points方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: coverage
# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import data_points [as 别名]
#.........这里部分代码省略.........
def exclude(self, regex):
"""Exclude source lines from execution consideration.
`regex` is a regular expression. Lines matching this expression are
not considered executable when reporting code coverage. A list of
regexes is maintained; this function adds a new regex to the list.
Matching any of the regexes excludes a source line.
"""
self.exclude_list.append(regex)
self.exclude_re = "(" + ")|(".join(self.exclude_list) + ")"
def get_exclude_list(self):
"""Return the list of excluded regex patterns."""
return self.exclude_list
def save(self):
"""Save the collected coverage data to the data file."""
self._harvest_data()
self.data.write()
def combine(self):
"""Combine together a number of similarly-named coverage data files.
All coverage data files whose name starts with `data_file` (from the
coverage() constructor) will be read, and combined together into the
current measurements.
"""
self.data.combine_parallel_data()
def _harvest_data(self):
"""Get the collected data by filename and reset the collector."""
self.data.add_line_data(self.collector.data_points())
self.collector.reset()
# Backward compatibility with version 1.
def analysis(self, morf):
"""Like `analysis2` but doesn't return excluded line numbers."""
f, s, _, m, mf = self.analysis2(morf)
return f, s, m, mf
def analysis2(self, morf):
"""Analyze a module.
`morf` is a module or a filename. It will be analyzed to determine
its coverage statistics. The return value is a 5-tuple:
* The filename for the module.
* A list of line numbers of executable statements.
* A list of line numbers of excluded statements.
* A list of line numbers of statements not run (missing from execution).
* A readable formatted string of the missing line numbers.
The analysis uses the source file itself and the current measured
coverage data.
"""
code_unit = code_unit_factory(morf, self.file_locator)[0]
st, ex, m, mf = self._analyze(code_unit)
return code_unit.filename, st, ex, m, mf
def _analyze(self, code_unit):
"""Analyze a single code unit.
Returns a 4-tuple: (statements, excluded, missing, missing formatted).