summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-12-24 19:46:00 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-12-24 19:46:00 -0500
commitb7a35186425cfef265548afc75b527752bed0c9a (patch)
tree30aac139732bb9a1b888783ff7db24baa2a6dfd3 /tests
parentb17f27672208a07318f8aa62a1bd64b18e9961d1 (diff)
downloadpython-coveragepy-git-b7a35186425cfef265548afc75b527752bed0c9a.tar.gz
A start on try/except/finally
--HG-- branch : ast-branch
Diffstat (limited to 'tests')
-rw-r--r--tests/test_arcs.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index f136b755..04c0df6e 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -481,6 +481,7 @@ class ExceptionArcTest(CoverageTest):
def test_break_in_finally(self):
+ # TODO: the name and the code don't seem to match
self.check_coverage("""\
a, c, d, i = 1, 1, 1, 99
try:
@@ -566,6 +567,23 @@ class ExceptionArcTest(CoverageTest):
arcz=".1 12 .3 3-2 24 45 56 67 7B 89 9B BC C.",
arcz_missing="67 7B", arcz_unpredicted="68")
+ def test_multiple_except_clauses(self):
+ self.check_coverage("""\
+ a, b, c = 1, 1, 1
+ try:
+ a = 3
+ except ValueError:
+ b = 5
+ except IndexError:
+ a = 7
+ finally:
+ c = 9
+ assert a == 3 and b == 1 and c == 9
+ """,
+ arcz=".1 12 23 45 39 59 67 79 9A A.", arcz_missing="45 59 67 79")
+ # TODO: do it again, with line 3 raising a caught exception
+ # TODO: do it again, with line 3 raising an uncaught exception.
+
class YieldTest(CoverageTest):
"""Arc tests for generators."""