diff options
| author | Jonathan Lange <jml@canonical.com> | 2011-08-15 14:20:51 +0100 |
|---|---|---|
| committer | Jonathan Lange <jml@canonical.com> | 2011-08-15 14:20:51 +0100 |
| commit | 413aa75b7db7f77818c92d3df4e3cf463ff696c4 (patch) | |
| tree | c74a451cd78c75a74c02f08f6429b5cb752deb17 /testtools/testcase.py | |
| parent | cc024f94b472201b7122e3c5120790c08702ce46 (diff) | |
| download | testtools-413aa75b7db7f77818c92d3df4e3cf463ff696c4.tar.gz | |
Review changes.
Diffstat (limited to 'testtools/testcase.py')
| -rw-r--r-- | testtools/testcase.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/testtools/testcase.py b/testtools/testcase.py index 18e49f2..9370b29 100644 --- a/testtools/testcase.py +++ b/testtools/testcase.py @@ -24,7 +24,10 @@ from testtools import ( content, try_import, ) -from testtools.compat import advance_iterator +from testtools.compat import ( + advance_iterator, + reraise, + ) from testtools.matchers import ( Annotate, Contains, @@ -373,7 +376,7 @@ class TestCase(unittest.TestCase): class ReRaiseOtherTypes(object): def match(self, matchee): if not issubclass(matchee[0], excClass): - raise matchee[0], matchee[1], matchee[2] + reraise(*matchee) class CaptureMatchee(object): def match(self, matchee): self.matchee = matchee[1] @@ -381,7 +384,7 @@ class TestCase(unittest.TestCase): matcher = Raises(MatchesAll(ReRaiseOtherTypes(), MatchesException(excClass), capture)) - self.assertThat(lambda:callableObj(*args, **kwargs), matcher) + self.assertThat(lambda: callableObj(*args, **kwargs), matcher) return capture.matchee failUnlessRaises = assertRaises @@ -392,8 +395,6 @@ class TestCase(unittest.TestCase): :param matcher: An object meeting the testtools.Matcher protocol. :raises self.failureException: When matcher does not match thing. """ - # XXX: Should this take an optional 'message' parameter? Would kind of - # make sense. The hamcrest one does. matcher = Annotate.if_message(message, matcher) mismatch = matcher.match(matchee) if not mismatch: |
