diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-11-17 22:30:38 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-11-17 22:30:38 -0500 |
commit | 688ecb98e29d9eb00e865813534e6e597c2b799d (patch) | |
tree | 47ff01706b4826103dedca01c13d30c81dbd8b58 /test/test_parser.py | |
parent | 120fcf1560e9b735dbf72ed173c717eef1fff514 (diff) | |
download | python-coveragepy-git-688ecb98e29d9eb00e865813534e6e597c2b799d.tar.gz |
Ignore the branch of an except clause testing its type, since these aren't conceptually branches. Fixes #35.
Diffstat (limited to 'test/test_parser.py')
-rw-r--r-- | test/test_parser.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_parser.py b/test/test_parser.py index 5a66f873..61572be5 100644 --- a/test/test_parser.py +++ b/test/test_parser.py @@ -34,3 +34,20 @@ class ParserTest(CoverageTest): self.assertEqual(cp.exit_counts(), { 2:1, 3:1, 4:2, 5:1, 7:1, 9:1, 10:1 }) + + def test_try_except(self): + cp = self.parse_source("""\ + try: + a = 2 + except ValueError: + a = 4 + except ZeroDivideError: + a = 6 + except: + a = 8 + b = 9 + """) + self.assertEqual(cp.exit_counts(), { + 1: 1, 2:1, 3:1, 4:1, 5:1, 6:1, 7:1, 8:1, 9:1 + }) +
\ No newline at end of file |