-
Notifications
You must be signed in to change notification settings - Fork 319
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
Feature/multiple validator #339
Conversation
instead of copying MultiType validator
def validate(self, value, context=''): | ||
super().validate(value=value, context=context) | ||
if not value % self._divisor == 0: | ||
raise TypeError('{} is not a multiple of {}; {}'.format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems more like a ValueError
than a TypeError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, changing that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@damazter just one quibble with the type of exception you raised, otherwise this is great. Thanks for the tests! 💃
@alexcjohnson |
I think the master branch is write protected, I still cannot merge. |
Merge: e80f019 5bcce8b Author: alexcjohnson <[email protected]> Merge pull request #339 from qdev-dk/feature/multiple_validator
Here is an overview of what got changed by this pull request: Complexity increasing per file
==============================
- qcodes/tests/test_validators.py 3
Clones added
============
- qcodes/tests/test_validators.py 7
See the complete overview on Codacy |
Changes proposed in this pull request:
Add a validator to check if input is a multiple integer of some divisor.
this code was part of #338 but should maybe be part of the qcodes core.
@giulioungaretti
@alexcjohnson