diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-03-06 18:59:23 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-03-06 18:59:23 +0000 |
commit | afc0cdfe7449c7821e22fe8ff9c27cf9eca1e7e0 (patch) | |
tree | 2c5591c4ce75402b629651dbdf50dcdc545ead5a /test/testlib/testing.py | |
parent | 4f35e8120fa7269f4090cef3b5e19fe16ce6c15a (diff) | |
download | sqlalchemy-afc0cdfe7449c7821e22fe8ff9c27cf9eca1e7e0.tar.gz |
corrected assert_raises to be consistent with existing assertRaises() unittest method
Diffstat (limited to 'test/testlib/testing.py')
-rw-r--r-- | test/testlib/testing.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test/testlib/testing.py b/test/testlib/testing.py index 3406e3504..1e24108dd 100644 --- a/test/testlib/testing.py +++ b/test/testlib/testing.py @@ -459,13 +459,12 @@ class TestBase(unittest.TestCase): """overridden to not return docstrings""" return None - def assert_raises(self, callable_, except_cls, reg): + def assertRaisesMessage(self, except_cls, msg, callable_, ): try: callable_() assert False, "Callable did not raise expected exception" - except Exception, e: - assert isinstance(e, except_cls), "Exception was not an instance of '%s' ('%s')" % (except_cls, type(e)) - assert re.search(reg, str(e)), "Callable raised non-matching exception: '%s'" % str(e) + except except_cls, e: + assert re.search(msg, str(e)), "Exception message did not match: '%s'" % str(e) if not hasattr(unittest.TestCase, 'assertTrue'): assertTrue = unittest.TestCase.failUnless |