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

Public Member Functions

def __eq__ (self, rhs)
 
def __eq__ (self, rhs)
 
def __ne__ (self, rhs)
 
def __ne__ (self, rhs)
 
def equals (self, rhs)
 
def equals (self, rhs)
 

Detailed Description

Base class for all Mox comparators.

A Comparator can be used as a parameter to a mocked method when the exact
value is not known.  For example, the code you are testing might build up a
long SQL string that is passed to your mock DAO. You're only interested that
the IN clause contains the proper primary keys, so you can set your mock
up as follows:

mock_dao.RunQuery(StrContains('IN (1, 2, 4, 5)')).AndReturn(mock_result)

Now whatever query is passed in must contain the string 'IN (1, 2, 4, 5)'.

A Comparator may replace one or more parameters, for example:
# return at most 10 rows
mock_dao.RunQuery(StrContains('SELECT'), 10)

or

# Return some non-deterministic number of rows
mock_dao.RunQuery(StrContains('SELECT'), IsA(int))

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

Member Function Documentation

◆ __eq__() [1/2]

def mox.Comparator.__eq__ (   self,
  rhs 
)

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

◆ __eq__() [2/2]

def mox.Comparator.__eq__ (   self,
  rhs 
)

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

◆ __ne__() [1/2]

def mox.Comparator.__ne__ (   self,
  rhs 
)

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

◆ __ne__() [2/2]

def mox.Comparator.__ne__ (   self,
  rhs 
)

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

◆ equals() [1/2]

def mox.Comparator.equals (   self,
  rhs 
)
Special equals method that all comparators must implement.

Args:
  rhs: any python object

Reimplemented in mox.IgnoreArg, mox.IgnoreArg, mox.Func, mox.Func, mox.Or, mox.Or, mox.And, mox.And, mox.ContainsKeyValue, mox.ContainsKeyValue, mox.In, mox.In, mox.Regex, mox.Regex, mox.StrContains, mox.StrContains, mox.IsAlmost, mox.IsAlmost, mox.IsA, mox.IsA, mox.SameElementsAs, and mox.SameElementsAs.

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

◆ equals() [2/2]

def mox.Comparator.equals (   self,
  rhs 
)

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


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