[patch][0.15] better DirState._validate
Robert Collins
robertc at robertcollins.net
Mon Mar 26 10:10:43 BST 2007
On Mon, 2007-03-26 at 18:53 +1000, Martin Pool wrote:
This could be more clear about what its trying to do: it does work, but
excClass can be a tuple in fact. Other than that, +1.
-Rob
> + def assertRaises(self, excClass, func, *args, **kwargs):
> + """Assert that a callable raises a particular exception.
> +
> + Returns the exception so that you can examine it.
> + """
> + try:
> + func(*args, **kwargs)
> + except excClass, e:
> + return e
> + else:
> + if getattr(excClass,'__name__', None) is not None:
> + excName = excClass.__name__
> + else:
> + excName = str(excClass)
> + raise self.failureException, "%s not raised" % excName
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070326/fc436a57/attachment-0001.pgp
More information about the bazaar
mailing list