Let's say I have the following:
def with_connection(f):
def decorated(*args, **kwargs):
f(get_connection(...), *args, **kwargs)
return decorated
@with_connection
def spam(connection):
# Do something
I want to test the spam function without going through the hassle of setting up a connection (or whatever the decorator is doing).
Given spam, how do I strip the decorator from it and get the underlying "undecorated" function?