Closed VolodyaCO closed 6 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
0ae6d26
) 90.85% compared to head (079184b
) 87.74%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
x_*
parameters are used for one-off projects and experimental features. For that reason, we do not include them in the MockDWaveSampler
. You could try setting parameter_warnings=False
if you want to test with x_*
parameters.
Ah, nevermind, I see that we raise an error for unknown kwargs.
IMO the better change would be to raise a warning rather than an error in that case.
@arcondello In that case, do I modify the code to make the change "raising error -> throwing a warning"?
For now, for your own testing, you can just do
MockDWaveSampler.parameters.update(x_simple_anneal_time=[])
before the main code.
If you're interested in making a deeper fix, I think the backwards compatible thing would be to add a ignore_unknown_parameters=False
class-level keyword argument to go with parameter_warnings
.
Then https://github.com/dwavesystems/dwave-system/blob/0ae6d260514eaa8f1c967955c6438fbda30c9154/dwave/system/testing.py#L317-L323 would be changed to something like
for kw in kwargs:
if kw in self.parameters:
if self.parameter_warnings and kw not in mocked_parameters:
warnings.warn(f'{kw!r} parameter is valid for DWaveSampler(), '
'but not mocked in MockDWaveSampler().')
elif not self.ignore_unknown_parameters:
raise ValueError(f'kwarg {kw!r} invalid for MockDWaveSampler()')
otherwise I can open an issue and we'll get to it sometime relatively soon.
Or even better would be to add a parameters
keyword argument, to go alongside properties that would allow the user to add additional parameters. Basically formalizing
MockDWaveSampler.parameters.update(x_simple_anneal_time=[])
as suggested above.
I'm popping x_*
parameters before passing them to the MockDWaveSampler
instead. If x_*
are related to experimental features, there's no reason to modify the source code, then. Thanks a lot for the help.
Apparently,
DWaveSampler
acceptsx_simple_anneal_time
, butMockDWaveSampler
does not. This PR just adds this argument to the list of arguments that should be ignored when passed toMockDWaveSampler
.