From: jlgijsbers Date: Tue, 2 Mar 2004 12:23:16 +0000 (+0000) Subject: Use assertRaises instead of introducing _nocheck machinery into assertRaisesMessage. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=33fc20f7ddf3017735e8c05c62999c4e229f86b6;p=roundup.git Use assertRaises instead of introducing _nocheck machinery into assertRaisesMessage. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2136 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/test/test_actions.py b/test/test_actions.py index 65a86f4..2e33429 100755 --- a/test/test_actions.py +++ b/test/test_actions.py @@ -38,14 +38,15 @@ class ActionTestCase(unittest.TestCase): self.client.form = self.form class ShowActionTestCase(ActionTestCase): - _nocheck = "don't compare exception values (the exception is enough)" def assertRaisesMessage(self, exception, callable, message, *args, - **kwargs): + **kwargs): + """An extension of assertRaises, which also checks the exception + message. We need this because we rely on exception messages when + redirecting. + """ try: callable(*args, **kwargs) except exception, msg: - if message is self._nocheck: - return self.assertEqual(str(msg), message) else: if hasattr(excClass,'__name__'): @@ -61,7 +62,7 @@ class ShowActionTestCase(ActionTestCase): self.assertRaises(ValueError, action.handle) self.form.value.append(MiniFieldStorage('@type', 'issue')) - self.assertRaisesMessage(SeriousError, action.handle, self._nocheck) + self.assertRaises(SeriousError, action.handle) self.form.value.append(MiniFieldStorage('@number', '1')) self.assertRaisesMessage(Redirect, action.handle, 'BASE/issue1')