summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_arcs.py20
-rw-r--r--tests/test_parser.py14
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index dd7e9b37..d18faf74 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -1246,6 +1246,26 @@ class LambdaArcTest(CoverageTest):
arcz_unpredicted="58",
)
+ def test_lambda_in_dict(self):
+ self.check_coverage("""\
+ x = 1
+ x = 2
+ d = {
+ 4: lambda: [],
+ 5: lambda: [],
+ 6: lambda: [],
+ 7: lambda: [],
+ }
+
+ for k, v in d.items(): # 10
+ if k & 1:
+ v()
+ """,
+ arcz=".1 12 23 3A AB BC BA CA A. .3 3-4 3-5 3-6 3-7",
+ arcz_missing="3-4 3-6",
+ arcz_unpredicted="",
+ )
+
class AsyncTest(CoverageTest):
"""Tests of the new async and await keywords in Python 3.5"""
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 0ede10b4..17f81ad8 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -329,6 +329,20 @@ class ParserMissingArcDescriptionTest(CoverageTest):
"because the return on line 12 wasn't executed"
)
+ def test_missing_arc_descriptions_bug460(self):
+ parser = self.parse_text(u"""\
+ x = 1
+ d = {
+ 3: lambda: [],
+ 4: lambda: [],
+ }
+ x = 6
+ """)
+ self.assertEqual(
+ parser.missing_arc_description(2, -3),
+ "line 3 didn't run the lambda on line 3",
+ )
+
class ParserFileTest(CoverageTest):
"""Tests for coverage.py's code parsing from files."""