Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added meaningful description to SplatMatcher

  • Loading branch information...
commit ca0f34e0d8993f694430f196d294f9bebb5ccfde 1 parent 7581363
@gfxmonk authored
View
4 mocktest/matchers/base.py
@@ -91,7 +91,7 @@ def matches(self, *a):
raise RuntimeError("SplatMatcher instance used without prefixing with '*'")
desc = matches
-class SplatMatcher(object):
+class SplatMatcher(Matcher):
def __init__(self, matcher):
self._matcher = matcher
@@ -99,7 +99,7 @@ def matches(self, args, kwargs):
return self._matcher.matches(args)
def desc(self):
- return "args where [%r]" % (self._matcher.desc(),)
+ return "args like [%r]" % (self._matcher.desc(),)
class ElementWiseSplatMatcher(SplatMatcher):
def matches(self, args, kwargs):
View
2  mocktest/mocking.py
@@ -244,7 +244,7 @@ def __call__(self, *a, **kw):
if act._matches(call):
return act._act_upon(call)
else:
- act_condition_descriptions = [" - " + act.condition_description for act in self._acts]
+ act_condition_descriptions = [" - " + act.condition_description for act in reversed(self._acts)]
raise TypeError("stubbed method %r received unexpected arguments: %s\nAllowable argument conditions are:\n%s" % (self._name, call.desc(),"\n".join(act_condition_descriptions)))
def _verify(self):
View
5 test/matchers/base_test.py
@@ -18,5 +18,6 @@ def test_anything_matcher_should_match_anything(self):
def test_not__matcher_should_invert_matches_and_descriptions(self):
self.assertFalse(Not(Any).matches(object()))
self.assertEqual(Not(Any).desc(), 'not any object')
-
-
+
+ def test_splat_matcher_should_have_a_meaningful_description(self):
+ self.assertEquals(repr(*any_args), "args like [\'any object\']")
Please sign in to comment.
Something went wrong with that request. Please try again.