stubs

Tools for setting up stubs and mocks.


Keywords
development, testing, mocking
License
Apache-2.0
Install
pip install stubs==1.0.0

Documentation

stubs

Tools for setting up stubs and mocks in Python. Example:

def f(x):
    return x * 2

with stub[f](_ >= 3) >> 5:
    print(f(2))  # prints 4
    print(f(3))  # prints 5
print(f(3))  # prints 6

For more details, see the docstrings in stubs.py and matchers.py.

To test, run py.test.