Exemple #1
0
    def test_ignores_provided_errors(self):
        a, k = (1, 2, 3), {'1': 1, '2': 2, '3': 3}
        def test_func(*args, **kwargs):
            return args, kwargs

        wrapped = ignore(test_func, (TypeError, KeyError))

        self.assertEqual((wrapped(*a, **k)), (a, k))
Exemple #2
0
    def test_ignores_provided_errors(self):
        a, k = (1, 2, 3), {'1': 1, '2': 2, '3': 3}

        def test_func(*args, **kwargs):
            return args, kwargs

        wrapped = ignore(test_func, (TypeError, KeyError))

        self.assertEqual((wrapped(*a, **k)), (a, k))
Exemple #3
0
    def test_does_ignore_other_errors(self):
        a, k = (1, 2, 3), {'1': 1, '2': 2, '3': 3}
        def test_func(*args, **kwargs):
            raise RuntimeError()

        wrapped = ignore(test_func, (TypeError, KeyError))

        with self.assertRaises(RuntimeError):
            wrapped(*a, **k)
Exemple #4
0
    def test_does_ignore_other_errors(self):
        a, k = (1, 2, 3), {'1': 1, '2': 2, '3': 3}

        def test_func(*args, **kwargs):
            raise RuntimeError()

        wrapped = ignore(test_func, (TypeError, KeyError))

        with self.assertRaises(RuntimeError):
            wrapped(*a, **k)