Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF: do not cause a side-effect on kwargs in @eval_results #3249

Merged
merged 1 commit into from Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions datalad/interface/tests/test_utils.py
Expand Up @@ -263,6 +263,11 @@ def test_eval_results_plus_build_doc():
result = Dataset('/does/not/matter').fake_command(3)
assert_equal(len(list(result)), 3)

# test absent side-effect of popping eval_defaults
kwargs = dict(return_type='list')
TestUtils().__call__(2, **kwargs)
assert_equal(list(kwargs), ['return_type'])

# test signature:
from inspect import getargspec
assert_equal(getargspec(Dataset.fake_command)[0], ['number', 'dataset'])
Expand Down
1 change: 1 addition & 0 deletions datalad/interface/utils.py
Expand Up @@ -331,6 +331,7 @@ def eval_func(wrapped, instance, args, kwargs):

# retrieve common options from kwargs, and fall back on the command
# class attributes, or general defaults if needed
kwargs = kwargs.copy() # we will pop, which might cause side-effect
common_params = {
p_name: kwargs.pop(
p_name,
Expand Down