Skip to content

Commit 0cfea0e

Browse files
committed
fixes
1 parent b37d368 commit 0cfea0e

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

extension_templates/experiments.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,13 @@ def _paramnames(self):
143143
144144
Returns
145145
-------
146-
list of str
146+
list of str, or None
147147
The parameter names of the search parameters.
148+
If not known or arbitrary, return None.
148149
"""
149150
# for every instance, this should return the correct parameter names
150151
# i.e., the maximal set of keys of the dict expected by _score
152+
# (if not known or arbitrary, return None)
151153
return ["score_param1", "score_param2"]
152154

153155
# todo: implement this, mandatory

src/hyperactive/base/_experiment.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ def _paramnames(self):
4949
5050
Returns
5151
-------
52-
list of str
52+
list of str, or None
5353
The parameter names of the search parameters.
54+
If not known or arbitrary, return None.
5455
"""
5556
return None
5657

src/hyperactive/tests/test_all_objects.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,10 @@ def test_paramnames(self, object_class):
167167
for inst, obj_param in zip(inst_params, obj_params):
168168
obj_inst = object_class(**inst)
169169
paramnames = obj_inst.paramnames()
170-
assert set(obj_param.keys()) <= set(
171-
paramnames
172-
), f"Parameter names do not match: {paramnames} != {obj_param}"
170+
if paramnames is not None:
171+
assert set(obj_param.keys()) <= set(
172+
paramnames
173+
), f"Parameter names do not match: {paramnames} != {obj_param}"
173174

174175
def test_score_function(self, object_class):
175176
"""Test that substituting into score works as intended."""

0 commit comments

Comments
 (0)