I have a decorator and I want to assert that certain methods in my code are decorated with it.
import functools
def decorator(func):
def _check_something(*args, **kwargs):
# some logic in here
return func(*args, **kwargs)
return functools.wraps(func)(_check_something)
class MyClass(object):
@decorator
def my_method(foo, bar):
pass
How do I assert with unittest (unitttest2) that my_method
has @decorator
and no-one removed it, and it was not forgotten?