Stub delegates¶

The value returned by the stub may be delegated from a function, method or other callable…

def get_user():
    return "Freddy"

with Stub() as stub:
    stub.user().delegates(get_user) "hello")

assert_that(stub.user(), is_("Freddy"))
assert_that(, is_("hello"))

It may be delegated from iterables or generators too!:

with Stub() as stub:[1, 2, 3])

assert_that(, is_(1))
assert_that(, is_(2))
assert_that(, is_(3))