'Ensure that the specified exception was raised.'

def assertRaisesAndMessageMatches(self, excClass, msg, callableObj, *args, **kwargs):

    caught = False
    try:
        callableObj(*args, **kwargs)
    except Exception as exc:
        caught = True
        self.assertIsInstance(exc, excClass, ('Wrong    exception    caught:    %s    Stacktrace:    %s' % (exc, traceback.format_exc())))
        self.assertIn(msg, six.text_type(exc))
    if (not caught):
        self.fail('Expected    raised    exception    but    nothing    caught.')
