is_greater_than#
- paramcheckup.numbers.is_greater_than(number, lower, param_name, kind, kind_name, inclusive=True, stacklevel=4, error=True)[source]#
This function checks if a number is equal (open or closed) or higher than lower.
- Parameters:
- numberint or float
The number that needs to be checked;
- lowerint or float
The lower bound;
- param_namestr
The name of the parameter that received the variable number;
- kindstr
The object where param_name is applied (function, method, class, etc.);
- kind_namestr
The name of the object kind;
- inclusivebool, optional
Specify whether the boundaries should be open (False) or closed (True, default);
- stacklevelint, optional
The stacking level (default is
4);- errorbool, optional
Whether to display error text (True, default) or not (False);
- Returns:
- outputTrue
If number IS greater than lower (or number IS equal/greater than lower);
- raisesValueError
If number is NOT greater than lower (or number is NOT equal/greater than lower);
Examples
>>> from paramcheckup import numbers >>> output = numbers.is_greater_than( number=0.05, lower=0, param_name="alpha", kind="function", kind_name="ttest", inclusive=True, stacklevel=3, error=True, ) >>> print(output) True
>>> from paramcheckup import numbers >>> output = numbers.is_greater_than( number=0.00, lower=0, param_name="alpha", kind="function", kind_name="ttest", inclusive=False, stacklevel=3, error=False, ) UserWarning at line 2: The value of `alpha` in function `ttest` must be greater than `0` (`alpha > 0`), but it is `0.0`.
>>> from paramcheckup import numbers >>> output = numbers.is_greater_than( number=-0.05, lower=0, param_name="alpha", kind="function", kind_name="ttest", inclusive=True, stacklevel=3, error=False, ) UserWarning at line 2: The value of `alpha` in function `ttest` must be equal or greater than `0` (`alpha >= 0`), but it is `-0.05`.