diff options
-rw-r--r-- | coverage/html.py | 30 | ||||
-rw-r--r-- | coverage/htmlfiles/pyfile.html | 8 | ||||
-rw-r--r-- | coverage/templite.py | 4 |
3 files changed, 21 insertions, 21 deletions
diff --git a/coverage/html.py b/coverage/html.py index 4d51eb34..39ee8866 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -69,27 +69,27 @@ class HtmlReporter(Reporter): arcs = self.arcs # These classes determine which lines are highlighted by default. - c_run = " run hide_run" - c_exc = " exc" - c_mis = " mis" - c_par = " par" + c_run + c_run = "run hide_run" + c_exc = "exc" + c_mis = "mis" + c_par = "par " + c_run lines = [] for lineno, line in enumerate(source_token_lines(source)): lineno += 1 # 1-based line numbers. # Figure out how to mark this line. - line_class = "" + line_class = [] annotate_html = "" annotate_title = "" if lineno in analysis.statements: - line_class += " stm" + line_class.append("stm") if lineno in analysis.excluded: - line_class += c_exc + line_class.append(c_exc) elif lineno in analysis.missing: - line_class += c_mis + line_class.append(c_mis) elif self.arcs and lineno in missing_branch_arcs: - line_class += c_par + line_class.append(c_par) n_par += 1 annlines = [] for b in missing_branch_arcs[lineno]: @@ -103,21 +103,21 @@ class HtmlReporter(Reporter): elif len(annlines) == 1: annotate_title = "no jump to this line number" elif lineno in analysis.statements: - line_class += c_run + line_class.append(c_run) # Build the HTML for the line - html = "" + html = [] for tok_type, tok_text in line: if tok_type == "ws": - html += escape(tok_text) + html.append(escape(tok_text)) else: tok_html = escape(tok_text) or ' ' - html += "<span class='%s'>%s</span>" % (tok_type, tok_html) + html.append("<span class='%s'>%s</span>" % (tok_type, tok_html)) lines.append({ - 'html': html, + 'html': ''.join(html), 'number': lineno, - 'class': line_class.strip() or "pln", + 'class': ' '.join(line_class) or "pln", 'annotate': annotate_html, 'annotate_title': annotate_title, }) diff --git a/coverage/htmlfiles/pyfile.html b/coverage/htmlfiles/pyfile.html index 79808c3b..ec69556d 100644 --- a/coverage/htmlfiles/pyfile.html +++ b/coverage/htmlfiles/pyfile.html @@ -16,11 +16,11 @@ </h1> <h2 class='stats'> {{nums.n_statements}} statements - <span class='{{c_run.strip}}' onclick='toggle_lines(this, "run")'>{{nums.n_executed}} run</span> - <span class='{{c_exc.strip}}' onclick='toggle_lines(this, "exc")'>{{nums.n_excluded}} excluded</span> - <span class='{{c_mis.strip}}' onclick='toggle_lines(this, "mis")'>{{nums.n_missing}} missing</span> + <span class='{{c_run}}' onclick='toggle_lines(this, "run")'>{{nums.n_executed}} run</span> + <span class='{{c_exc}}' onclick='toggle_lines(this, "exc")'>{{nums.n_excluded}} excluded</span> + <span class='{{c_mis}}' onclick='toggle_lines(this, "mis")'>{{nums.n_missing}} missing</span> {% if arcs %} - <span class='{{c_par.strip}}' onclick='toggle_lines(this, "par")'>{{n_par}} partial</span> + <span class='{{c_par}}' onclick='toggle_lines(this, "par")'>{{n_par}} partial</span> {% endif %} </h2> </div> diff --git a/coverage/templite.py b/coverage/templite.py index 66f38a9c..c39e061e 100644 --- a/coverage/templite.py +++ b/coverage/templite.py @@ -118,10 +118,10 @@ class _TempliteEngine(object): """ for op, args in ops: if op == 'lit': - self.result += args + self.result.append(args) elif op == 'exp': try: - self.result += str(self.evaluate(args)) + self.result.append(str(self.evaluate(args))) except: exc_class, exc, _ = sys.exc_info() new_exc = exc_class("Couldn't evaluate {{ %s }}: %s" |