gvwilson / sdxpy

Software Design by Example: a tool-based introduction with Python

Home Page:https://third-bit.com/sdxpy/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

/protocols - Section 9.1: Mock Objects (2024-01-12)

zihanltesla opened this issue · comments

Hi!
I think "fakeit" can better discribe the feature of the intend here:

def fixit(name, func=None, value=None):
    assert name in globals()
    fake = Fake(func, value)
    globals()[name] = fake
    return fake

In my understanding we want exactly to replace the original function in the global environment to a fake object? Thanks!