[pypy-svn] rev 506 - pypy/trunk/src/pypy/interpreter
mwh at codespeak.net
mwh at codespeak.net
Tue May 27 11:55:00 CEST 2003
Author: mwh
Date: Tue May 27 11:55:00 2003
New Revision: 506
Modified:
pypy/trunk/src/pypy/interpreter/unittest_w.py
Log:
Add assertWRaises_w to check that a wrapped callable raises the right kind of
wrapped exception. I'm not so sold on the name.
Modified: pypy/trunk/src/pypy/interpreter/unittest_w.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/unittest_w.py (original)
+++ pypy/trunk/src/pypy/interpreter/unittest_w.py Tue May 27 11:55:00 2003
@@ -30,3 +30,12 @@
self.failUnless(e.match(self.space, w_exc_class))
else:
self.fail('should have got an exception')
+
+ def assertWRaises_w(self, w_exc_class, w_callable, *args_w, **kw_w):
+ from pypy.objspace.std.objspace import OperationError
+ try:
+ self.space.call_function(w_callable, *args_w, **kw_w)
+ except OperationError, e:
+ self.failUnless(e.match(self.space, w_exc_class))
+ else:
+ self.fail('should have got an exception')
More information about the Pypy-commit
mailing list