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

Feature/multiple validator #339

Merged
merged 8 commits into from
Sep 22, 2016
Merged

Feature/multiple validator #339

merged 8 commits into from
Sep 22, 2016

Conversation

damazter
Copy link
Contributor

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

@damazter damazter mentioned this pull request Sep 22, 2016
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(
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

@alexcjohnson alexcjohnson left a 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! 💃

@damazter
Copy link
Contributor Author

@alexcjohnson
github asks for another 💃

@damazter
Copy link
Contributor Author

I think the master branch is write protected, I still cannot merge.
so I give the 💃 to the core developers
@giulioungaretti @alexcjohnson

@alexcjohnson alexcjohnson merged commit a8d5198 into master Sep 22, 2016
@alexcjohnson alexcjohnson deleted the feature/multiple_validator branch September 22, 2016 14:26
giulioungaretti pushed a commit that referenced this pull request Sep 22, 2016
Merge: e80f019 5bcce8b
Author: alexcjohnson <[email protected]>

    Merge pull request #339 from qdev-dk/feature/multiple_validator
@qcodes-bot
Copy link

Codacy 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants