diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-01-03 11:08:06 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-01-03 11:08:06 -0500 |
commit | a2cb815e890f092822fa211713ff3d33887afd86 (patch) | |
tree | d9d2e7324d0c4c37fb5c150635e4a629f1b67000 /tests/test_arcs.py | |
parent | 25e74d4547a784a96420bb7e5b0653376f3568a6 (diff) | |
download | python-coveragepy-git-a2cb815e890f092822fa211713ff3d33887afd86.tar.gz |
Fix arcs for function and class decorators
--HG--
branch : ast-branch
Diffstat (limited to 'tests/test_arcs.py')
-rw-r--r-- | tests/test_arcs.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py index 607ff68e..8b524db7 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -871,6 +871,53 @@ class MiscArcTest(CoverageTest): arcs_missing=[], arcs_unpredicted=[], ) + def test_function_decorator(self): + self.check_coverage("""\ + def decorator(arg): + def _dec(f): + return f + return _dec + + @decorator(6) + @decorator( + len([8]), + ) + def my_function( + a=len([11]), + ): + x = 13 + a = 14 + my_function() + """, + arcz= + ".1 16 67 7A AE EF F. " # main line + ".2 24 4. .3 3-2 " # decorators + ".D D-6 ", # my_function + ) + + def test_class_decorator(self): + self.check_coverage("""\ + def decorator(arg): + def _dec(c): + return c + return _dec + + @decorator(6) + @decorator( + len([8]), + ) + class MyObject( + object + ): + X = 13 + a = 14 + """, + arcz= + ".1 16 67 6D 7A AE E. " # main line + ".2 24 4. .3 3-2 " # decorators + ".6 D-6 ", # MyObject + ) + class AsyncTest(CoverageTest): def setUp(self): |