本文整理匯總了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).