Skip to content

Commit

Permalink
Merge pull request #2388 from kmantel/parameters
Browse files Browse the repository at this point in the history
tests: Parameters: add check for _additional_param_attr_properties
  • Loading branch information
kmantel authored Apr 21, 2022
2 parents 1f6a4ab + 0ca4de0 commit e95af01
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion psyneulink/core/globals/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,6 @@ class Parameter(ParameterBase):
'default_value',
'history_max_length',
'log_condition',
'delivery_condition',
'spec',
}

Expand Down
11 changes: 11 additions & 0 deletions tests/misc/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,17 @@ def test_function_user_specified(kwargs, parameter, is_user_specified):
assert getattr(t.function.parameters, parameter)._user_specified == is_user_specified


# sort param names or pytest-xdist may cause failure
# see https://github.com/pytest-dev/pytest/issues/4101
@pytest.mark.parametrize('attr', sorted(pnl.Parameter._additional_param_attr_properties))
def test_additional_param_attrs(attr):
assert hasattr(pnl.Parameter, f'_set_{attr}'), (
f'To include {attr} in Parameter._additional_param_attr_properties, you'
f' must add a _set_{attr} method on Parameter. If this is unneeded,'
' remove it from Parameter._additional_param_attr_properties.'
)


class TestSharedParameters:

recurrent_mech = pnl.RecurrentTransferMechanism(default_variable=[0, 0], enable_learning=True)
Expand Down

0 comments on commit e95af01

Please sign in to comment.