Public Member Functions | Private Member Functions | Private Attributes | List of all members
mox.MockAnything Class Reference
Inheritance diagram for mox.MockAnything:
Inheritance graph
[legend]

Public Member Functions

def __eq__ (self, rhs)
 
def __eq__ (self, rhs)
 
def __getattr__ (self, method_name)
 
def __getattr__ (self, method_name)
 
def __init__ (self)
 
def __init__ (self)
 
def __ne__ (self, rhs)
 
def __ne__ (self, rhs)
 
def __nonzero__ (self)
 
def __nonzero__ (self)
 

Private Member Functions

def _CreateMockMethod (self, method_name)
 
def _CreateMockMethod (self, method_name)
 
def _Replay (self)
 
def _Replay (self)
 
def _Reset (self)
 
def _Reset (self)
 
def _Verify (self)
 
def _Verify (self)
 

Private Attributes

 _expected_calls_queue
 
 _replay_mode
 

Detailed Description

A mock that can be used to mock anything.

This is helpful for mocking classes that do not provide a public interface.

Definition at line 268 of file bloaty/third_party/protobuf/python/mox.py.

Constructor & Destructor Documentation

◆ __init__() [1/2]

def mox.MockAnything.__init__ (   self)
 

Definition at line 274 of file bloaty/third_party/protobuf/python/mox.py.

◆ __init__() [2/2]

def mox.MockAnything.__init__ (   self)
 

Definition at line 274 of file protobuf/python/mox.py.

Member Function Documentation

◆ __eq__() [1/2]

def mox.MockAnything.__eq__ (   self,
  rhs 
)
Provide custom logic to compare objects.

Reimplemented in mox.MockObject, and mox.MockObject.

Definition at line 314 of file bloaty/third_party/protobuf/python/mox.py.

◆ __eq__() [2/2]

def mox.MockAnything.__eq__ (   self,
  rhs 
)
Provide custom logic to compare objects.

Reimplemented in mox.MockObject, and mox.MockObject.

Definition at line 314 of file protobuf/python/mox.py.

◆ __getattr__() [1/2]

def mox.MockAnything.__getattr__ (   self,
  method_name 
)
Intercept method calls on this object.

 A new MockMethod is returned that is aware of the MockAnything's
 state (record or replay).  The call will be recorded or replayed
 by the MockMethod's __call__.

Args:
  # method name: the name of the method being called.
  method_name: str

Returns:
  A new MockMethod aware of MockAnything's state (record or replay).

Reimplemented in mox.MockObject, and mox.MockObject.

Definition at line 278 of file bloaty/third_party/protobuf/python/mox.py.

◆ __getattr__() [2/2]

def mox.MockAnything.__getattr__ (   self,
  method_name 
)
Intercept method calls on this object.

 A new MockMethod is returned that is aware of the MockAnything's
 state (record or replay).  The call will be recorded or replayed
 by the MockMethod's __call__.

Args:
  # method name: the name of the method being called.
  method_name: str

Returns:
  A new MockMethod aware of MockAnything's state (record or replay).

Reimplemented in mox.MockObject, and mox.MockObject.

Definition at line 278 of file protobuf/python/mox.py.

◆ __ne__() [1/2]

def mox.MockAnything.__ne__ (   self,
  rhs 
)
Provide custom logic to compare objects.

Definition at line 321 of file bloaty/third_party/protobuf/python/mox.py.

◆ __ne__() [2/2]

def mox.MockAnything.__ne__ (   self,
  rhs 
)
Provide custom logic to compare objects.

Definition at line 321 of file protobuf/python/mox.py.

◆ __nonzero__() [1/2]

def mox.MockAnything.__nonzero__ (   self)
Return 1 for nonzero so the mock can be used as a conditional.

Definition at line 309 of file protobuf/python/mox.py.

◆ __nonzero__() [2/2]

def mox.MockAnything.__nonzero__ (   self)
Return 1 for nonzero so the mock can be used as a conditional.

Definition at line 309 of file bloaty/third_party/protobuf/python/mox.py.

◆ _CreateMockMethod() [1/2]

def mox.MockAnything._CreateMockMethod (   self,
  method_name 
)
private
Create a new mock method call and return it.

Args:
  # method name: the name of the method being called.
  method_name: str

Returns:
  A new MockMethod aware of MockAnything's state (record or replay).

Definition at line 295 of file bloaty/third_party/protobuf/python/mox.py.

◆ _CreateMockMethod() [2/2]

def mox.MockAnything._CreateMockMethod (   self,
  method_name 
)
private
Create a new mock method call and return it.

Args:
  # method name: the name of the method being called.
  method_name: str

Returns:
  A new MockMethod aware of MockAnything's state (record or replay).

Definition at line 295 of file protobuf/python/mox.py.

◆ _Replay() [1/2]

def mox.MockAnything._Replay (   self)
private
Start replaying expected method calls.

Definition at line 326 of file protobuf/python/mox.py.

◆ _Replay() [2/2]

def mox.MockAnything._Replay (   self)
private
Start replaying expected method calls.

Definition at line 326 of file bloaty/third_party/protobuf/python/mox.py.

◆ _Reset() [1/2]

def mox.MockAnything._Reset (   self)
private
Reset the state of this mock to record mode with an empty queue.

Definition at line 349 of file bloaty/third_party/protobuf/python/mox.py.

◆ _Reset() [2/2]

def mox.MockAnything._Reset (   self)
private
Reset the state of this mock to record mode with an empty queue.

Definition at line 349 of file protobuf/python/mox.py.

◆ _Verify() [1/2]

def mox.MockAnything._Verify (   self)
private
Verify that all of the expected calls have been made.

Raises:
  ExpectedMethodCallsError: if there are still more method calls in the
expected queue.

Definition at line 331 of file bloaty/third_party/protobuf/python/mox.py.

◆ _Verify() [2/2]

def mox.MockAnything._Verify (   self)
private
Verify that all of the expected calls have been made.

Raises:
  ExpectedMethodCallsError: if there are still more method calls in the
expected queue.

Definition at line 331 of file protobuf/python/mox.py.

Member Data Documentation

◆ _expected_calls_queue

mox.MockAnything._expected_calls_queue
private

Definition at line 319 of file bloaty/third_party/protobuf/python/mox.py.

◆ _replay_mode

mox.MockAnything._replay_mode
private

Definition at line 318 of file bloaty/third_party/protobuf/python/mox.py.


The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:41