def assertRaisesExactly(cls, fn, *args, **kwargs):
    try:
        fn(*args, **kwargs)
    except Exception as e:
        assert e.__class__ == cls, "got %s, expected %s" % (
            e.__class__.__name__, cls.__name__)
    else:
        raise AssertionError("%s not raised" % cls)
Unlike the standard assertRaises, this checks that a function raises a
dataset/ETHPy150Open mongodb/mongo-python-driver/test/utils.py/assertRaisesExactly