Comment

Peter Bengtsson

Thank you! Clearly I'm not alone in being anal about testing *exactly* which exception is raised.

Parent comment

A. Jesse Jiryu Davis

I'm not surprised by this behavior, but sometimes you do want to check the exact error class. When I changed a function in PyMongo to raise a different error in the same hiearchy, I wrote assertRaisesExactly as an alternative to assertRaises: https://github.com/mongodb/mongo-python-driver/blob/master/test/utils.py#L62