Exemplo n.º 1
0
        def _(self):
            some_instance = SomeClass()

            def some_function(*args, **kwargs):
                return "some_value"

            some_instance.some_function = some_function

            with AttachedSpy(some_instance, "some_function").call_real():
                result = some_instance.some_function("anything", ["can"],
                                                     go="here")
                expect(result).to_be("some_value")
Exemplo n.º 2
0
        def _(self):
            def some_function(*args, **kwargs):
                return "some_value"

            some_instance = SomeClass()
            some_instance.some_function = some_function

            with AttachedSpy(some_instance, "some_function") as spy:
                some_instance.some_function("anything", ["can"], go="here")
                expect(spy.last_call).to_be((("anything", ["can"]), {
                    "go": "here"
                }))
            expect(some_instance.some_function).to_be(some_function)
Exemplo n.º 3
0
        def _(self):
            some_instance = SomeClass()

            def some_function(*args, **kwargs):
                return "some_value"

            some_instance.some_function = some_function
            expect(lambda: stub(some_instance.some_function)
                   ).to_raise_error_of_type(ValueError)