def test_get_wrapped_object(self): """ Make sure in ``Decorator``, ``get_wrapped_object`` returns the input. """ d = Decorator() d.to_wrap = mock.sentinel.object assert d.get_wrapped_object() is mock.sentinel.object
def test_as_decorator(self): """ Make sure ``to_decorator`` normalizes the wrapper """ d = Decorator.as_decorator() def f(): pass assert f is d(f) assert f is d()(f) class F(object): pass assert F is d(F) assert F is d()(F)