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

[REQUEST] - methods to validate non positive and non negative numbers #1

Closed
natanfeitosa opened this issue Jan 17, 2023 · 0 comments
Closed
Labels
enhancement New feature or request

Comments

@natanfeitosa
Copy link
Owner

Is your feature request related to a problem? Please describe.
Methods to validate non-positive and non-negative numbers to make the process more concise and standardized

Describe the solution you'd like

from kohi import NumberSchema

NumberSchema().nonnegative().validate(-1) # False
NumberSchema().nonnegative().validate(0) # True
NumberSchema().nonnegative().throw().validate(-1) # ValidationError: number must be greater than or equal to 0

NumberSchema().nonpositive().validate(1) # False
NumberSchema().nonpositive().validate(0) # True
NumberSchema().nonpositive().throw().validate(1) # ValidationError: number must be less than or equal to 0
@natanfeitosa natanfeitosa added the enhancement New feature or request label Jan 17, 2023
natanfeitosa added a commit that referenced this issue Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant