summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-01-07 19:42:42 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-01-07 19:42:42 -0500
commit858c44bb1007511a69e0ed9ea60ccd3f9fe3eb56 (patch)
tree76b097f4d2be368c2a9794b4dc0c8f61d985c45c /tests
parent0e58be3b9eefb65cb6e2dcabbc1934fa5cb00872 (diff)
downloadpython-coveragepy-858c44bb1007511a69e0ed9ea60ccd3f9fe3eb56.tar.gz
Add tests of multiline lambdas, though i don't quite understand the line numbers involved
Diffstat (limited to 'tests')
-rw-r--r--tests/test_arcs.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 28c1df7..c52bc8a 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -1031,6 +1031,34 @@ class DecoractorArcTest(CoverageTest):
)
+class LambdaArcTest(CoverageTest):
+ """Tests of lambdas"""
+
+ def test_lambda(self):
+ self.check_coverage("""\
+ fn = (lambda x:
+ x + 2
+ )
+ assert fn(4) == 6
+ """,
+ arcz=".1 14 4-1 1-1",
+ )
+ self.check_coverage("""\
+
+ fn = \\
+ (
+ lambda
+ x:
+ x
+ +
+ 8
+ )
+ assert fn(10) == 18
+ """,
+ arcz=".2 2A A-4 2-4",
+ )
+
+
class AsyncTest(CoverageTest):
"""Tests of the new async and await keywords in Python 3.5"""
@@ -1108,7 +1136,6 @@ class AsyncTest(CoverageTest):
async with x:
pass
""",
- # TODO: we don't run any code, so many arcs are missing.
arcz=".1 1. .2 23 3.",
arcz_missing=".2 23 3.",
)