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?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…