Serhiy Storchaka added the comment: You can use assertRaisesRegex() for this. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <report at bugs.python.org> <http://bugs.python.org/issue27132> _______________________________________