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")
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)
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)