diff options
| -rw-r--r-- | src/decorator.py | 4 | ||||
| -rw-r--r-- | src/tests/test.py | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/decorator.py b/src/decorator.py index a6435e9..45d61a4 100644 --- a/src/decorator.py +++ b/src/decorator.py @@ -76,6 +76,7 @@ except ImportError: DEF = re.compile(r'\s*def\s*([_\w][_\w\d]*)\s*\(') POS = inspect.Parameter.POSITIONAL_OR_KEYWORD +EMPTY = inspect.Parameter.empty # basic functionality @@ -261,7 +262,8 @@ def decorator(caller, _func=None): def dec(func=None, *args, **kw): na = len(args) + 1 extras = args + tuple(kw.get(p.name, p.default) - for p in dec_params[na:]) + for p in dec_params[na:] + if p.default is not EMPTY) if func is None: return lambda func: decorate(func, caller, extras) else: diff --git a/src/tests/test.py b/src/tests/test.py index bff23bd..83e54aa 100644 --- a/src/tests/test.py +++ b/src/tests/test.py @@ -151,7 +151,7 @@ class ExtraTestCase(unittest.TestCase): @decorator def catch_config_error(method, app, *args, **kwargs): return method(app) - catch_config_error(lambda app: None) + catch_config_error(lambda app, **kw: None)(1) def test_add1(self): # similar to what IPython is doing in traitlets.config.application |
