Feature/validated tuple#205
Conversation
|
Thanks @rkern, This PR is ready for review |
|
I could probably provide add an optional string in the trait metadata to be used for the TraitError. For example if would be nice is we could get this error TraitError: The 'value_range' trait of a MyClass instance must be a tuple of the form: (an integer (int or long), an integer (int or long)) that passes custom validation: value_range[0] < value_rane[1], but a value of (2, 1) <type 'tuple'> was specified. |
There was a problem hiding this comment.
Can we change the name of this keyword argument? validator would be more accurate than validation. Alternatively, how about just valid (to be thought of as "is_valid").
There was a problem hiding this comment.
The convention in Traits seems to be validate for this kind of argument.
There was a problem hiding this comment.
there is a method called validate in TraitType. I have renamed the keyword to fvalidatewhich is the same used for Property traits.
|
We need docs for the new Trait type. |
There was a problem hiding this comment.
Too much whitespace! Please remove the last blank line inside the docstring, to be consistent with the surrounding style.
the fvalidate method
|
@mdickinson, the PR is now updated. I tried to follow the local style, please let me know if I missed anything. |
|
please delay review. I should add a change log comment |
|
@mdickinson, the PR is ready for another review round |
|
@itziakos: I've tweaked a bit. Please let me know if you're happy with the changes in the last 4 commits. |
|
@mdickinson, changes look ok. |
|
@itziakos: Thanks. Merging. |
This PR adds a new Tuple trait that supports custom validation for the field values in addition to the individual field validation.