webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | List of all members
mox.Comparator Class Reference
Inheritance diagram for mox.Comparator:
mox.And mox.ContainsKeyValue mox.Func mox.IgnoreArg mox.In mox.IsA mox.IsAlmost mox.Or mox.Regex mox.SameElementsAs mox.StrContains

Public Member Functions

def equals (self, rhs)
 
def __eq__ (self, rhs)
 
def __ne__ (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))

Member Function Documentation

◆ __eq__()

def mox.Comparator.__eq__ (   self,
  rhs 
)

◆ __ne__()

def mox.Comparator.__ne__ (   self,
  rhs 
)

◆ equals()

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

Args:
  rhs: any python object

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