HEX
Server: Apache
System: Linux beluga.o2switch.net 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP Thu May 7 23:17:13 UTC 2026 x86_64
User: sc3naki1272 (1113)
PHP: 8.3.33
Disabled: NONE
Upload Files
File: //opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/raises.py
from decorator import decorator


# Thought pytest.raises was like nose.raises, but nooooooo. So let's make it
# like that.
def raises(klass):

    @decorator
    def inner(f, *args, **kwargs):
        try:
            f(*args, **kwargs)
        except klass:
            pass
        else:
            raise Exception(
                "Did not receive expected {}!".format(klass.__name__)
            )

    return inner