diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-12-03 08:54:27 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-12-03 08:54:27 -0500 |
commit | 3b6e8394c3e50cb733caafb275d2ae85c0397565 (patch) | |
tree | dd960443f9ef3772020d74c102d785968bb44dce /coverage/annotate.py | |
parent | 3416380e8e46d839c3111d9f82a5f7d93a218821 (diff) | |
parent | 9e4908f37c370250ebc7836e744a59170720a9e3 (diff) | |
download | python-coveragepy-git-3b6e8394c3e50cb733caafb275d2ae85c0397565.tar.gz |
Merged default onto config.
--HG--
branch : config
Diffstat (limited to 'coverage/annotate.py')
-rw-r--r-- | coverage/annotate.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/coverage/annotate.py b/coverage/annotate.py index 2fa9d5cf..2117b657 100644 --- a/coverage/annotate.py +++ b/coverage/annotate.py @@ -6,11 +6,11 @@ from coverage.report import Reporter class AnnotateReporter(Reporter): """Generate annotated source files showing line coverage. - + This reporter creates annotated copies of the measured source files. Each .py file is copied as a .py,cover file, with a left-hand margin annotating each line:: - + > def h(x): - if 0: #pragma: no cover - pass @@ -18,30 +18,30 @@ class AnnotateReporter(Reporter): ! a = 1 > else: > a = 2 - + > h(2) Executed lines use '>', lines not executed use '!', lines excluded from consideration use '-'. - + """ def __init__(self, coverage, ignore_errors=False): super(AnnotateReporter, self).__init__(coverage, ignore_errors) self.directory = None - + blank_re = re.compile(r"\s*(#|$)") else_re = re.compile(r"\s*else\s*:\s*(#|$)") def report(self, morfs, directory=None, omit_prefixes=None): """Run the report.""" self.report_files(self.annotate_file, morfs, directory, omit_prefixes) - + def annotate_file(self, cu, analysis): """Annotate a single file. - + `cu` is the CodeUnit for the file to annotate. - + """ if not cu.relative: return @@ -77,7 +77,7 @@ class AnnotateReporter(Reporter): if self.blank_re.match(line): dest.write(' ') elif self.else_re.match(line): - # Special logic for lines containing only 'else:'. + # Special logic for lines containing only 'else:'. if i >= len(statements) and j >= len(missing): dest.write('! ') elif i >= len(statements) or j >= len(missing): |