From 8f6da482a2bef7a22a2d704eab98150f40b07211 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 8 Nov 2009 13:50:05 -0500 Subject: Shouldn't count multiple (-1,x) arcs as branches. --- coverage/results.py | 4 ++++ test/test_summary.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/coverage/results.py b/coverage/results.py index 138782e..59cc1fa 100644 --- a/coverage/results.py +++ b/coverage/results.py @@ -98,6 +98,8 @@ class Analysis(object): """Returns lines that have more than one exit.""" exit_counts = {} for l1,l2 in self.arc_possibilities(): + if l1 == -1: + continue if l1 not in exit_counts: exit_counts[l1] = 0 exit_counts[l1] += 1 @@ -107,6 +109,8 @@ class Analysis(object): def total_branches(self): exit_counts = {} for l1,l2 in self.arc_possibilities(): + if l1 == -1: + continue if l1 not in exit_counts: exit_counts[l1] = 0 exit_counts[l1] += 1 diff --git a/test/test_summary.py b/test/test_summary.py index bbf5f02..4e18e1d 100644 --- a/test/test_summary.py +++ b/test/test_summary.py @@ -99,8 +99,8 @@ class SummaryTest(CoverageTest): # Name Stmts Exec Branch BrExec Cover # -------------------------------------------- - # mybranch 5 5 4 3 88% + # mybranch 5 5 2 1 85% self.assertEqual(self.line_count(report), 3) self.assert_("mybranch " in report) - self.assertEqual(self.last_line_squeezed(report), "mybranch 5 5 4 3 88%") + self.assertEqual(self.last_line_squeezed(report), "mybranch 5 5 2 1 85%") -- cgit v1.2.1