Number Conditions - GenesisCoast/conditions-py GitHub Wiki
Introduction
Conditions
is_in_range(min_value: number, max_value: number)
Checks whether the given value is between min_value
and max_value
range.
An ArgumentOutOfRangeError
error is thrown otherwise.
Arguments
- min_value (num) - Specifies the minimum value, that the value can be.
- max_value (num) - Specifies the maximum value, that the value can be.
Exceptions
Throws an ArgumentOutOfRangeError
when the value to be validated is not within the specified range.
Example
value = 5
min_value = 0
max_value = 4
Condition\
.requires_num(value, "value")\
.is_in_range(min_value, max_value) # Throws an `ArgumentOutOfRangeError`
Condition\
.ensures_num(value, "value")\
.is_in_range(min_value, max_value) # Throws an `ArgumentOutOfRangeError`
is_not_in_range(min_value: number, max_value: number)
Checks whether the given value is not between min_value
and max_value
Condition.is_not_in_range(min_value: number, max_value: number)
is_greater_than(min_value: number)
Checks whether the given value is greater than the specified min_value
.
Condition.is_greater_than(min_value: number)
is_greater_or_equal(min_value: number)
Checks whether the given value is greater or equal to the specified min_value
.
Condition.is_greater_or_equal(min_value: number)
is_less_than(max_value: number)
Checks whether the given value is less than the specified max_value
.
Condition.is_less_than(max_value: number)
is_less_or_equal(max_value: number)
Checks whether the given value is less or equal to the specified max_value
.
Condition.is_less_or_equal(max_value: number)
is_equal_to(value: number)
Checks whether the given value is equal to the specified value
.
Condition.is_equal_to(value: number)
is_not_equal_to(value: number)
Checks whether the given value is not equal to the specified value
.
Condition.is_not_equal_to(value: number)
is_positive(self)
Checks to see whether the given value is positive or not.
Condition.is_positive(self)
is_negative(self)
Checks to see whether the given value is positive or not.
Condition.is_negative(self)