def assertRaisesInstance(self, excInstance, callableObj, *args, **kwargs):
    '\n        This assertion accepts an instance instead of a class for refined\n        exception testing.\n        '
    kwargs = (kwargs or {})
    excClass = excInstance.__class__
    try:
        callableObj(*args, **kwargs)
    except excClass as e:
        assert str(e).startswith(str(excInstance))
    else:
        if hasattr(excClass, '__name__'):
            excName = excClass.__name__
        else:
            excName = str(excClass)
        raise self.failureException(('%s not raised' % excName))
This assertion accepts an instance instead of a class for refined
exception testing.
def assertRaisesInstance(self, excInstance, callableObj, *args, **kwargs):
    '\n        This assertion accepts an instance instead of a class for refined\n        exception testing.\n        '
    kwargs = (kwargs or {})
    excClass = excInstance.__class__
    try:
        callableObj(*args, **kwargs)
    except excClass as e:
        assert str(e).startswith(str(excInstance))
    else:
        if hasattr(excClass, '__name__'):
            excName = excClass.__name__
        else:
            excName = str(excClass)
        raise self.failureException(('%s not raised' % excName))