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
gt, lt, #188
gt, lt, #188
Conversation
Codecov Report
@@ Coverage Diff @@
## master #188 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 9 9
Lines 1036 1036
Branches 214 214
=====================================
Hits 1036 1036 |
tests/test_types.py
Outdated
@@ -836,3 +836,27 @@ class Model(BaseModel): | |||
assert exc_info.value.flatten_errors() == result | |||
else: | |||
assert Model(foo=value).foo == result | |||
|
|||
|
|||
def test_gt(): |
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.
maybe better to name test_number_gt
and test_number_lt
?
with pytest.raises(ValidationError) as exc_info: | ||
Model(a=-1) | ||
assert ( | ||
'ensure this value is greater than -1 (type=value_error.number.gt; limit_value=-1)' |
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.
why you want to use string representation of errors not .flatten_errors()
like in all other tests?
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.
I was just doing the quickest thing, doing it various different ways in tests is a good thing.
👍 |
* improve tuple schema definition * add "mode" to tuple schema * made "mode" optinonal on variable tuples * tweak enum names
fix #176