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 | 4fd78e63c89803d50972df4128f08572bab53581 (patch) | |
| tree | a2e7e962dcda7becbec77839adbdb87fc6495285 /test | |
| parent | bde336007c71badfa08b431d6ec53997fe53036d (diff) | |
| download | python-coveragepy-4fd78e63c89803d50972df4128f08572bab53581.tar.gz | |
Ignore the branch of an except clause testing its type, since these aren't conceptually branches. Fixes #35.
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_arcs.py | 4 | ||||
| -rw-r--r-- | test/test_parser.py | 17 |
2 files changed, 19 insertions, 2 deletions
diff --git a/test/test_arcs.py b/test/test_arcs.py index 00567ac..dea3700 100644 --- a/test/test_arcs.py +++ b/test/test_arcs.py @@ -265,8 +265,8 @@ class ExceptionArcTest(CoverageTest): assert try_it(0) == 8 # C assert try_it(1) == 6 # D """, - arcz=".1 12 .3 3. 24 4C CD D. .5 56 67 78 8B 9A 9B AB B.", - arcz_missing="9B", # never got an exception other than ValueError + arcz=".1 12 .3 3. 24 4C CD D. .5 56 67 78 8B 9A AB B.", + arcz_missing="", arcz_unpredicted="79") def test_try_finally(self): diff --git a/test/test_parser.py b/test/test_parser.py index 5a66f87..61572be 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 |
