Class p.u.t.m.Mock:

Part of pida.utils.testing.mock View In Hierarchy

The Mock class emulates any other class for testing purposes. All method calls are stored for later examination.
Line # Kind Name Docs
69 Method __init__ The Mock class constructor takes a dictionary of method names and
94 Method _setupSubclassMethodInterceptors Undocumented
103 Method __getattr__ Undocumented
106 Method mockAddReturnValues Undocumented
109 Method mockSetExpectation Undocumented
112 Method _checkInterfaceCall Check that a call to a method of the given name to the original
148 Method mockGetAllCalls Return a list of MockCall objects,
156 Method mockGetNamedCalls Return a list of MockCall objects,
164 Method mockCheckCall test that the index-th call had the specified name and parameters
def __init__(self, returnValues=None, realClass=None):
The Mock class constructor takes a dictionary of method names and the values they return. Methods that are not in the returnValues dictionary will return None. You may also supply a class whose interface is being mocked. All calls will be checked to see if they appear in the original interface. Any calls to methods not appearing in the real class will raise a MockInterfaceError. Any calls that would fail due to non-matching parameter lists will also raise a MockInterfaceError. Both of these help to prevent the Mock class getting out of sync with the class it is Mocking.
def _setupSubclassMethodInterceptors(self):
Undocumented
def __getattr__(self, name):
Undocumented
def mockAddReturnValues(self, **methodReturnValues):
Undocumented
def mockSetExpectation(self, name, testFn, after=0, until=0):
Undocumented
def _checkInterfaceCall(self, name, callParams, callKwParams):
Check that a call to a method of the given name to the original class with the given parameters would not fail. If it would fail, raise a MockInterfaceError. Based on the Python 2.3.3 Reference Manual section 5.3.4: Calls.
def mockGetAllCalls(self):
Return a list of MockCall objects, representing all the methods in the order they were called.
def mockGetNamedCalls(self, methodName):
Return a list of MockCall objects, representing all the calls to the named method in the order they were called.
def mockCheckCall(self, index, name, *args, **kwargs):
test that the index-th call had the specified name and parameters
API Documentation for PIDA, generated by pydoctor.