コード例 #1
0
    def test_ignore_ignores_error(self):
        try:
            with utils.ignore(ZeroDivisionError):
                undef = 1 / 0.
                success = False
            success = True
        except Exception:
            success = False

        self.assertTrue(success)
コード例 #2
0
    def test_ignore_ignores_multiple(self):
        success = True

        try:
            with utils.ignore(ZeroDivisionError, KeyError):
                x = {}['key']
                success = False
            success = True
        except Exception:
            success = False

        self.assertTrue(success)