Ejemplo n.º 1
0
    def test_expect_not_to_raise_error_can_take_callable_with_args(self):
        class SpecialException(Exception):
            pass

        argument = object()

        def callable_(x):
            if not x is argument:
                raise SpecialException('foo')

        expect(callable_, argument).not_to(raise_error(SpecialException))
Ejemplo n.º 2
0
    def test_expect_not_to_raise_error_can_take_callable_with_args(self):
        class SpecialException(Exception):
            pass

        argument = object()

        def callable_(x):
            if not x is argument:
                raise SpecialException('foo')

        expect(callable_, argument).not_to(raise_error(SpecialException))
Ejemplo n.º 3
0
    def test_expect_to_raise_error_can_take_callable_with_arg_and_kwargs(self):
        class SpecialException(Exception):
            pass

        argument = object()
        kwargs = dict(x=argument)

        def callable_(arg, x=None):
            if arg is argument and x is argument:
                raise SpecialException('foo')

        expect(callable_, argument, **kwargs).to(raise_error(SpecialException))
Ejemplo n.º 4
0
    def test_expect_to_raise_error_can_take_callable_with_arg_and_kwargs(self):
        class SpecialException(Exception):
            pass

        argument = object()
        kwargs = dict(x=argument)

        def callable_(arg, x=None):
            if arg is argument and x is argument:
                raise SpecialException('foo')

        expect(callable_, argument, **kwargs).to(raise_error(SpecialException))
Ejemplo n.º 5
0
 def test_expect_pop_from_list_not_to_raise_IndexError(self):
     expect([0].pop).not_to(raise_error(IndexError))
Ejemplo n.º 6
0
 def test_expect_pop_from_empty_list_to_raise_IndexError(self):
     expect([].pop).to(raise_error(IndexError))
Ejemplo n.º 7
0
 def test_expect_pop_from_list_not_to_raise_IndexError(self):
     expect([0].pop).not_to(raise_error(IndexError))
Ejemplo n.º 8
0
 def test_expect_pop_from_empty_list_to_raise_IndexError(self):
     expect([].pop).to(raise_error(IndexError))