summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-10-08 11:43:00 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-10-08 11:43:00 -0400
commit35b28c01047f644cd4f1f3e10881ce14e5df87fd (patch)
tree3f3b4c33d07163201e370fbf54073f953266b95a
parentee5d7ba0ad86068f9413a54659a2f8a58cd97f31 (diff)
downloadpython-coveragepy-git-35b28c01047f644cd4f1f3e10881ce14e5df87fd.tar.gz
test: mark some uncovered things
-rw-r--r--coverage/cmdline.py3
-rw-r--r--coverage/misc.py4
-rw-r--r--coverage/parser.py8
3 files changed, 12 insertions, 3 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py
index 1fa52a97..eae22f2f 100644
--- a/coverage/cmdline.py
+++ b/coverage/cmdline.py
@@ -646,6 +646,9 @@ class CoverageScript:
show_contexts=options.show_contexts,
**report_args
)
+ else:
+ # There are no other possible actions.
+ raise AssertionError
if total is not None:
# Apply the command line fail-under options, and then use the config
diff --git a/coverage/misc.py b/coverage/misc.py
index 0f985be0..30b75744 100644
--- a/coverage/misc.py
+++ b/coverage/misc.py
@@ -329,10 +329,12 @@ def substitute_variables(text, variables):
)
"""
+ dollar_groups = ('dollar', 'word1', 'word2')
+
def dollar_replace(match):
"""Called for each $replacement."""
# Only one of the groups will have matched, just get its text.
- word = next(g for g in match.group('dollar', 'word1', 'word2') if g)
+ word = next(g for g in match.group(*dollar_groups) if g) # pragma: always breaks
if word == "$":
return "$"
elif word in variables:
diff --git a/coverage/parser.py b/coverage/parser.py
index 8792d0ac..5c467a7e 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -437,11 +437,15 @@ class BlockBase:
# pylint: disable=unused-argument
def process_break_exits(self, exits, add_arc):
"""Process break exits."""
- return False
+ # Because break can only appear in loops, and most subclasses
+ # implement process_break_exits, this function is never reached.
+ raise AssertionError
def process_continue_exits(self, exits, add_arc):
"""Process continue exits."""
- return False
+ # Because continue can only appear in loops, and most subclasses
+ # implement process_continue_exits, this function is never reached.
+ raise AssertionError
def process_raise_exits(self, exits, add_arc):
"""Process raise exits."""