def compare(self, candidate):
     if not isinstance(candidate, UltimateObject):
         raise VoodooException("Parameter (%s) is not an UltimateObject" %
                               pprint.pformat(candidate))
     if candidate.voodooPath() != self._voodooPath:
         raise VoodooException(
             "UltimateObject's path (%s) is not as expected (%s)" %
             (pprint.pformat(candidate), pprint.pformat(self._voodooPath)))
    def compare(self, args, kwargs):
        expectedNumOfParams = len( self._voodooParamExpectations ) + \
                  len( self._voodooKwargsExpectations )
        if len(args) != len(self._voodooParamExpectations):
            raise VoodooException(
                "Wrong number of parameters while calling %s; "
                "expected %d parameters, found %d" %
                (self._voodooPath, len(
                    self._voodooParamExpectations), len(args)))
        if len(kwargs) != len(self._voodooKwargsExpectations):
            raise VoodooException(
                "Wrong number of kwargs parameters while calling %s; "
                "expected %d kwargs parameters, found %d" %
                (self._voodooPath, len(
                    self._voodooKwargsExpectations), len(kwargs)))
        for i in range(len(self._voodooParamExpectations)):
            if not hasattr(self._voodooParamExpectations[i], 'compare'):
                message = (
                    "ERROR: the expectation does not have a 'compare' method: type %s;"
                    "perhaps you forgot 'ParamEquals'? ") % type(
                        self._voodooParamExpectations[i])
                print "PyVoodoo:", message
                raise VoodooException(message)
            self._voodooParamExpectations[i].compare(args[i])

        TS_ASSERT_EQUALS(sorted(kwargs.keys()),
                         sorted(self._voodooKwargsExpectations.keys()))
        for key in kwargs.keys():
            if not hasattr(self._voodooKwargsExpectations[key], 'compare'):
                message = (
                    "ERROR: the expectation does not have a 'compare' method: type %s, key %s;"
                    "perhaps you forgot 'ParamEquals'? ") % (type(
                        self._voodooKwargsExpectations[key]), key)
                print "PyVoodoo:", message
                raise VoodooException(message)
            self._voodooKwargsExpectations[key].compare(kwargs[key])
 def compare(self, value):
     if value:
         raise VoodooException(
             "Parameter (%s) expected to evaluate to False" %
             pprint.pformat(value))
 def compare(self, value):
     if value is not self._voodooValue:
         raise VoodooException(
             "Parameter (%s) expected to be (%s)" %
             (pprint.pformat(value), pprint.pformat(self._voodooValue)))
 def compare(self, value):
     import re
     if re.search(self._voodooExpression, value) is None:
         raise VoodooException(
             "Parameter '%s' does not match regular expression '%s'" %
             (value, self._voodooExpression))
 def compare(self, value):
     if value == self._voodooValue:
         raise VoodooException("Parameters equal (%s == %s)" %
                               (value, self._voodooValue))
 def compare(self, value):
     if value / self._voodooValue < 0.999999 or value / self._voodooValue > 1.000001:
         raise VoodooException("Parameters not (float) equal (%s != %s)" %
                               (value, self._voodooValue))
 def compare(self, value):
     if value != self._voodooValue:
         raise VoodooException(
             "Parameters not equal (%s != %s)" %
             (pprint.pformat(value), pprint.pformat(self._voodooValue)))