aspectlib.test¶
aspectlib.test.record | Factory or decorator (depending if func is initially given). |
aspectlib.test.mock | Factory for a decorator that makes the function return a given return_value. |
- class aspectlib.test.Call¶
Call(self, args, kwargs)
- args¶
Alias for field number 1
- kwargs¶
Alias for field number 2
- self¶
Alias for field number 0
- class aspectlib.test.RecordingWrapper(wrapped, wrapper, calls)[source]¶
Function wrapper that has a calls attribute.
Parameters: - wrapped (function) – Function to be wrapped
- wrapped – Wrapper function
- calls (list) – Instance to put in the .calls attribute.
- aspectlib.test.mock(return_value, call=False)[source]¶
Factory for a decorator that makes the function return a given return_value.
Parameters: - return_value – Value to return from the wrapper.
- call (bool) – If True, call the decorated function.
Returns: A decorator.
- aspectlib.test.record(func=None, call=False, history=None)[source]¶
Factory or decorator (depending if func is initially given).
The decorator returns a wrapper that records all calls made to func.
Parameters: - history (list) – An object where the Call objects are appended. If not given a new list object will be created.
- call (bool) – If True the func will be called.
Returns: A wrapper that has a calls property.