Exemplo n.º 1
0
 def _verify_call_order(self, flex_objects):
     for exp in flex_objects[self.mock]:
         if (exp.method == self.method and
                 not _match_args(self.args, exp.args) and
                 not exp._times_called):
             raise CallOrderError(
                     '%s called before %s' %
                     (_format_args(self.method, self.args),
                      _format_args(exp.method, exp.args)))
         if (exp.method == self.method and
                 self.args and exp.args and    # ignore default stub case
                 _match_args(self.args, exp.args)):
             break
Exemplo n.º 2
0
Arquivo: wrap.py Projeto: has207/flex
 def __get_expectation(self, name=None, args=None):
     """Gets attached to the object under mock and is called in that context."""
     if args == None:
         args = {'kargs': (), 'kwargs': {}}
     if not isinstance(args, dict):
         args = {'kargs': args, 'kwargs': {}}
     if not isinstance(args['kargs'], tuple):
         args['kargs'] = (args['kargs'],)
     if name and self in _flex_objects:
         for e in reversed(_flex_objects[self]):
             if e.method == name and _match_args(args, e.args):
                 if e._ordered:
                     e._verify_call_order(_flex_objects)
                 return e