diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2011-06-03 23:19:10 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2011-06-03 23:19:10 -0400 |
commit | 64a2ffaaa2739ab0df4db7322e51c3faae7bafdb (patch) | |
tree | 53dfa364510f45a93d3a06c0881be80ade9d2441 /test/test_coverage.py | |
parent | d2ef0b1e323c85e9a7fc3782bc4d5cd5511d9a74 (diff) | |
download | python-coveragepy-git-64a2ffaaa2739ab0df4db7322e51c3faae7bafdb.tar.gz |
Fix a test involving optimized-away constant if statements, and add a test about them.
Diffstat (limited to 'test/test_coverage.py')
-rw-r--r-- | test/test_coverage.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test_coverage.py b/test/test_coverage.py index 7c12b3a7..5da9cb16 100644 --- a/test/test_coverage.py +++ b/test/test_coverage.py @@ -842,6 +842,16 @@ class CompoundStatementTest(CoverageTest): """, [1,2,4,5,7,9,10], "4, 7") + if sys.version_info >= (2, 4): + # In 2.4 and up, constant if's were compiled away. + def test_constant_if(self): + self.check_coverage("""\ + if 1: + a = 2 + assert a == 2 + """, + [2,3], "") + def test_while(self): self.check_coverage("""\ a = 3; b = 0 |