mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add tests for wraps
During testing I also discovered that `_ignores_kwargs` was also missing the @wraps decorator. Now it has it.
This commit is contained in:
parent
1670b5d647
commit
0670614c6a
2 changed files with 37 additions and 0 deletions
|
@ -643,6 +643,7 @@ def ignores_kwargs(*kwarg_names):
|
|||
List of argument names to ignore
|
||||
'''
|
||||
def _ignores_kwargs(fn):
|
||||
@wraps(fn)
|
||||
def __ignores_kwargs(*args, **kwargs):
|
||||
kwargs_filtered = kwargs.copy()
|
||||
for name in kwarg_names:
|
||||
|
|
|
@ -352,3 +352,39 @@ class DecoratorsTest(TestCase):
|
|||
depr._curr_version = self._mk_version("Helium")[1]
|
||||
with self.assertRaises(SaltConfigurationError):
|
||||
assert depr(self.new_function)() == self.new_function()
|
||||
|
||||
def test_with_depreciated_should_wrap_function(self):
|
||||
def func(): pass
|
||||
|
||||
wrapped = decorators.with_deprecated({}, "Beryllium")(func)
|
||||
assert wrapped.__module__ == func.__module__
|
||||
|
||||
def test_is_deprecated_should_wrap_function(self):
|
||||
def func(): pass
|
||||
|
||||
wrapped = decorators.is_deprecated({}, "Beryllium")(func)
|
||||
assert wrapped.__module__ == func.__module__
|
||||
|
||||
def test_ensure_unicode_args_should_wrap_function(self):
|
||||
def func(): pass
|
||||
|
||||
wrapped = decorators.ensure_unicode_args(func)
|
||||
assert wrapped.__module__ == func.__module__
|
||||
|
||||
def test_ignores_kwargs_should_wrap_function(self):
|
||||
def func(): pass
|
||||
|
||||
wrapped = decorators.ignores_kwargs('foo', 'bar')(func)
|
||||
assert wrapped.__module__ == func.__module__
|
||||
|
||||
def test_memoize_should_wrap_function(self):
|
||||
def func(): pass
|
||||
|
||||
wrapped = decorators.memoize(func)
|
||||
assert wrapped.__module__ == func.__module__
|
||||
|
||||
def timing_should_wrap_function(self):
|
||||
def func(): pass
|
||||
|
||||
wrapped = decorators.timing(func)
|
||||
assert wrapped.__module__ == func.__module__
|
Loading…
Add table
Reference in a new issue