Permalink
Browse files

just a little more info about a unexpected call on mock object. Also

fixed but when returns gets a tuple.
  • Loading branch information...
1 parent 8a08f54 commit b579c9d7e6beff1e45d117154653b6230551e3ae @vbabiy vbabiy committed Jun 9, 2011
Showing with 4 additions and 2 deletions.
  1. +1 −1 chai/expectation.py
  2. +3 −1 chai/mock.py
View
@@ -211,6 +211,6 @@ def test(self, *args, **kwargs):
def __str__(self):
runs_string = " Ran: %s, Min Runs: %s, Max Runs: %s" % (self._run_count, self._min_count, "" if self._max_count == None else self._max_count)
- return_string = " Raises: %s" % self._raises if self._raises else " Returns: %s" % self._returns
+ return_string = " Raises: %s" % self._raises if self._raises else " Returns: %s" % repr(self._returns)
return "\n\t%s\n\t%s\n\t\t%s\n\t\t%s" % (colored("%s - %s" % (self._stub.name, "Passed" if self._arguments_rule._passed else "Failed")
, "green" if self._arguments_rule._passed else "red"), self._arguments_rule, return_string, runs_string)
View
@@ -25,7 +25,9 @@ def __init__(self, **kwargs):
def __call__(self, *args, **kwargs):
if isinstance(getattr(self,'__call__'), Stub):
return getattr(self,'__call__')(*args, **kwargs)
- raise UnexpectedCall()
+
+ # FIXME: this need to be formated.
+ raise UnexpectedCall("on %s : %s : %s" % (self._name, args, kwargs))
def __getattr__(self,name):
rval = self.__dict__.get(name)

0 comments on commit b579c9d

Please sign in to comment.