|
def | __call__ (self, *params, **named_params) |
|
def | __call__ (self, *params, **named_params) |
|
def | __class__ (self) |
|
def | __class__ (self) |
|
def | __eq__ (self, rhs) |
|
def | __eq__ (self, rhs) |
|
def | __getattr__ (self, name) |
|
def | __getattr__ (self, name) |
|
def | __getitem__ (self, key) |
|
def | __getitem__ (self, key) |
|
def | __init__ (self, class_to_mock) |
|
def | __init__ (self, class_to_mock) |
|
def | __setitem__ (self, key, value) |
|
def | __setitem__ (self, key, value) |
|
def | __init__ (self) |
|
def | __init__ (self) |
|
def | __ne__ (self, rhs) |
|
def | __ne__ (self, rhs) |
|
def | __nonzero__ (self) |
|
def | __nonzero__ (self) |
|
A mock object that simulates the public/protected interface of a class.
Definition at line 359 of file bloaty/third_party/protobuf/python/mox.py.
◆ __init__() [1/2]
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
Definition at line 362 of file bloaty/third_party/protobuf/python/mox.py.
◆ __init__() [2/2]
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
Definition at line 362 of file protobuf/python/mox.py.
◆ __call__() [1/2]
def mox.MockObject.__call__ |
( |
|
self, |
|
|
* |
params, |
|
|
** |
named_params |
|
) |
| |
◆ __call__() [2/2]
def mox.MockObject.__call__ |
( |
|
self, |
|
|
* |
params, |
|
|
** |
named_params |
|
) |
| |
◆ __class__() [1/2]
def mox.MockObject.__class__ |
( |
|
self | ) |
|
◆ __class__() [2/2]
def mox.MockObject.__class__ |
( |
|
self | ) |
|
◆ __eq__() [1/2]
def mox.MockObject.__eq__ |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
◆ __eq__() [2/2]
def mox.MockObject.__eq__ |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
◆ __getattr__() [1/2]
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.
Reimplemented from mox.MockAnything.
Definition at line 386 of file protobuf/python/mox.py.
◆ __getattr__() [2/2]
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.
Reimplemented from mox.MockAnything.
Definition at line 386 of file bloaty/third_party/protobuf/python/mox.py.
◆ __getitem__() [1/2]
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__.
Definition at line 459 of file bloaty/third_party/protobuf/python/mox.py.
◆ __getitem__() [2/2]
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__.
Definition at line 459 of file protobuf/python/mox.py.
◆ __setitem__() [1/2]
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__.
Definition at line 427 of file bloaty/third_party/protobuf/python/mox.py.
◆ __setitem__() [2/2]
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__.
Definition at line 427 of file protobuf/python/mox.py.
◆ _class_to_mock
mox.MockObject._class_to_mock |
|
private |
◆ _expected_calls_queue
mox.MockObject._expected_calls_queue |
|
private |
◆ _known_methods
mox.MockObject._known_methods |
|
private |
◆ _known_vars
mox.MockObject._known_vars |
|
private |
◆ _replay_mode
mox.MockObject._replay_mode |
|
private |
The documentation for this class was generated from the following file: