summaryrefslogtreecommitdiff
path: root/doc/excluding.rst
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-11-28 07:38:09 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-11-28 07:38:09 -0500
commitf80837ae0385019de7b9a3d50a286a5fce0dfb46 (patch)
tree1be804a75a7ce8a83371141d25b03cc43da68856 /doc/excluding.rst
parentb2cf3b8d1f1908c3d9732387346f038f84cc6ca0 (diff)
downloadpython-coveragepy-git-f80837ae0385019de7b9a3d50a286a5fce0dfb46.tar.gz
Doc tweaking.
Diffstat (limited to 'doc/excluding.rst')
-rw-r--r--doc/excluding.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/excluding.rst b/doc/excluding.rst
index 1072e5b1..31aa6838 100644
--- a/doc/excluding.rst
+++ b/doc/excluding.rst
@@ -39,6 +39,24 @@ coverage data as usual. When producing reports though, coverage excludes it from
the list of missing code.
+Branch coverage
+---------------
+
+When measuring :ref:`branch coverage <branch>`, a condtional will not be
+counted as a branch if one of its choices is excluded::
+
+ def only_one_choice(x):
+ if x:
+ blah1()
+ blah2()
+ else: # pragma: no cover
+ # x is always true.
+ blah3()
+
+Because the ``else`` clause is excluded, the ``if`` only has one possible
+next line, so it isn't considered a branch at all.
+
+
Advanced exclusion
------------------
@@ -64,3 +82,4 @@ Here's a list of exclusions I've used::
coverage.exclude('if 0:')
coverage.exclude('if __name__ == .__main__.:')
+