summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-01-09 08:28:25 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-01-09 08:28:25 -0500
commit68e3e9a32b70708bcb689b344f6bd2eeedbca271 (patch)
tree5f1aa098803f1bc6e27155311e68f5ee7c8e55a7
parentbc712fa95cbd7ca554a1d2fef8b26f15f897f09b (diff)
downloadpython-coveragepy-git-68e3e9a32b70708bcb689b344f6bd2eeedbca271.tar.gz
Add a test of partial lambdas
-rw-r--r--coverage/parser.py1
-rw-r--r--tests/test_arcs.py23
2 files changed, 22 insertions, 2 deletions
diff --git a/coverage/parser.py b/coverage/parser.py
index babf4d73..9f7400e5 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -260,7 +260,6 @@ class PythonParser(object):
"""
if self._all_arcs is None:
- import pudb,sys as __sys;__sys.stdout=__sys.__stdout__;pudb.set_trace() # -={XX}=-={XX}=-={XX}=-
aaa = AstArcAnalyzer(self.text, self.raw_funcdefs, self.raw_classdefs)
arcs = aaa.collect_arcs()
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 1131555a..c8814779 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -641,8 +641,8 @@ class ExceptionArcTest(CoverageTest):
arcz=".1 12 23 35 56 61 17 7.",
)
- # "except Exception as e" is crucial here.
def test_bug_212(self):
+ # "except Exception as e" is crucial here.
self.check_coverage("""\
def b(exc):
try:
@@ -1058,6 +1058,27 @@ class LambdaArcTest(CoverageTest):
arcz=".1 12 .2 2-2 23 3.", arcz_missing=".2 2-2",
)
+ def test_raise_with_lambda_looks_like_partial_branch(self):
+ self.check_coverage("""\
+ def ouch(fn):
+ 2/0
+ a = b = c = d = 3
+ try:
+ a = ouch(lambda: 5)
+ if a:
+ b = 7
+ except ZeroDivisionError:
+ c = 9
+ d = 10
+ assert (a, b, c, d) == (3, 3, 9, 10)
+ """,
+ lines=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
+ missing="6-7",
+ arcz=".1 13 34 45 56 67 6A 7A 89 9A AB B. .2 2. .5 5-5",
+ arcz_missing="56 67 6A 7A .5 5-5",
+ arcz_unpredicted="58",
+ )
+
class AsyncTest(CoverageTest):
"""Tests of the new async and await keywords in Python 3.5"""