diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-01-04 20:12:55 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-01-04 20:12:55 -0500 |
commit | 4074315ac65ed79e94bc331a8059859781b5b12b (patch) | |
tree | 1769e15e4a74fa225656193a6bf236f0c184bac3 /tests/test_arcs.py | |
parent | eda903304b8ea1fd72d2a33fe794df45c7d92127 (diff) | |
download | python-coveragepy-git-4074315ac65ed79e94bc331a8059859781b5b12b.tar.gz |
Support comprehensions better
--HG--
branch : ast-branch
Diffstat (limited to 'tests/test_arcs.py')
-rw-r--r-- | tests/test_arcs.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py index 8b524db7..fb4b99eb 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -378,6 +378,54 @@ class LoopArcTest(CoverageTest): arcz=".1 .2 2-2 12 23 34 45 53 3.", ) + def test_multiline_dict_comp(self): + if env.PYVERSION < (2, 7): + self.skip("Don't have set or dict comprehensions before 2.7") + if env.PY2: + arcz = ".2 2B B-4 2-4" + else: + arcz = ".2 2B B-3 2-3" + # Multiline dict comp: + self.check_coverage("""\ + # comment + d = \\ + { + i: + str(i) + for + i + in + range(9) + } + x = 11 + """, + arcz=arcz, + ) + # Multi dict comp: + if env.PY2: + arcz = ".2 2F F-4 2-4" + else: + arcz = ".2 2F F-3 2-3" + self.check_coverage("""\ + # comment + d = \\ + { + (i, j): + str(i+j) + for + i + in + range(9) + for + j + in + range(13) + } + x = 15 + """, + arcz=arcz, + ) + class ExceptionArcTest(CoverageTest): """Arc-measuring tests involving exception handling.""" |