From b7a35186425cfef265548afc75b527752bed0c9a Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 24 Dec 2015 19:46:00 -0500 Subject: A start on try/except/finally --HG-- branch : ast-branch --- tests/test_arcs.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') 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.""" -- cgit v1.2.1