webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
|
Public Member Functions | |
def | __init__ (self, class_to_mock) |
def | __getattr__ (self, name) |
def | __eq__ (self, rhs) |
def | __setitem__ (self, key, value) |
def | __getitem__ (self, key) |
def | __call__ (self, params, named_params) |
def | __class__ (self) |
Public Member Functions inherited from mox.MockAnything | |
def | __init__ (self) |
def | __getattr__ (self, method_name) |
def | __nonzero__ (self) |
def | __eq__ (self, rhs) |
def | __ne__ (self, rhs) |
A mock object that simulates the public/protected interface of a class.
def mox.MockObject.__init__ | ( | self, | |
class_to_mock | |||
) |
Initialize a mock object. This determines the methods and properties of the class and stores them. Args: # class_to_mock: class to be mocked class_to_mock: class
def mox.MockObject.__call__ | ( | self, | |
params, | |||
named_params | |||
) |
Provide custom logic for mocking classes that are callable.
def mox.MockObject.__class__ | ( | self | ) |
Return the class that is being mocked.
def mox.MockObject.__eq__ | ( | self, | |
rhs | |||
) |
Provide custom logic to compare objects.
def mox.MockObject.__getattr__ | ( | self, | |
name | |||
) |
Intercept attribute request on this object. If the attribute is a public class variable, it will be returned and not recorded as a call. If the attribute is not a variable, it is handled like a method call. The method name is checked against the set of mockable methods, and a new MockMethod is returned that is aware of the MockObject's state (record or replay). The call will be recorded or replayed by the MockMethod's __call__. Args: # name: the name of the attribute being requested. name: str Returns: Either a class variable or a new MockMethod that is aware of the state of the mock (record or replay). Raises: UnknownMethodCallError if the MockObject does not mock the requested method.
def mox.MockObject.__getitem__ | ( | self, | |
key | |||
) |
Provide custom logic for mocking classes that are subscriptable. Args: key: Key to return the value for. Returns: Expected return value in replay mode. A MockMethod object for the __getitem__ method that has already been called if not in replay mode. Raises: TypeError if the underlying class is not subscriptable. UnexpectedMethodCallError if the object does not expect the call to __setitem__.
def mox.MockObject.__setitem__ | ( | self, | |
key, | |||
value | |||
) |
Provide custom logic for mocking classes that support item assignment. Args: key: Key to set the value for. value: Value to set. Returns: Expected return value in replay mode. A MockMethod object for the __setitem__ method that has already been called if not in replay mode. Raises: TypeError if the underlying class does not support item assignment. UnexpectedMethodCallError if the object does not expect the call to __setitem__.