Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Private Attributes
test.support.Matcher Class Reference
Inheritance diagram for test.support.Matcher:
Inheritance graph
[legend]
Collaboration diagram for test.support.Matcher:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def matches
def match_value

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Private Attributes

tuple _partial_matches = ('msg', 'message')

Detailed Description

Definition at line 1476 of file support.py.


Member Function Documentation

def test.support.Matcher.match_value (   self,
  k,
  dv,
  v 
)
Try to match a single stored value (dv) with a supplied value (v).

Definition at line 1497 of file support.py.

01497 
01498     def match_value(self, k, dv, v):
01499         """
01500         Try to match a single stored value (dv) with a supplied value (v).
01501         """
01502         if type(v) != type(dv):
01503             result = False
01504         elif type(dv) is not str or k not in self._partial_matches:
01505             result = (v == dv)
01506         else:
01507             result = dv.find(v) >= 0
01508         return result
01509 

Here is the caller graph for this function:

def test.support.Matcher.matches (   self,
  d,
  kwargs 
)
Try to match a single dict with the supplied arguments.

Keys whose values are strings and which are in self._partial_matches
will be checked for partial (i.e. substring) matches. You can extend
this scheme to (for example) do regular expression matching, etc.

Definition at line 1480 of file support.py.

01480 
01481     def matches(self, d, **kwargs):
01482         """
01483         Try to match a single dict with the supplied arguments.
01484 
01485         Keys whose values are strings and which are in self._partial_matches
01486         will be checked for partial (i.e. substring) matches. You can extend
01487         this scheme to (for example) do regular expression matching, etc.
01488         """
01489         result = True
01490         for k in kwargs:
01491             v = kwargs[k]
01492             dv = d.get(k)
01493             if not self.match_value(k, dv, v):
01494                 result = False
01495                 break
01496         return result

Here is the call graph for this function:


Member Data Documentation

tuple test.support.Matcher._partial_matches = ('msg', 'message') [static, private]

Definition at line 1478 of file support.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


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