Number Matchers¶
Matchers that perform numeric comparisons.
See also, Number matcher internals
close_to¶
- hamcrest.library.number.iscloseto.close_to(value: float, delta: float) hamcrest.core.matcher.Matcher[float] ¶
- hamcrest.library.number.iscloseto.close_to(value: decimal.Decimal, delta: decimal.Decimal) hamcrest.core.matcher.Matcher[decimal.Decimal]
Matches if object is a number close to a given value, within a given delta.
- Parameters
value – The value to compare against as the expected value.
delta – The maximum delta between the values for which the numbers are considered close.
This matcher compares the evaluated object against
value
to see if the difference is within a positivedelta
.Example:
close_to(3.0, 0.25)
greater_than, greater_than_or_equal_to, less_than, less_than_or_equal_to¶
- hamcrest.library.number.ordering_comparison.greater_than(value)¶
Matches if object is greater than a given value.
- Parameters
value (Any) – The value to compare against.
- Return type
- hamcrest.library.number.ordering_comparison.greater_than_or_equal_to(value)¶
Matches if object is greater than or equal to a given value.
- Parameters
value (Any) – The value to compare against.
- Return type
- hamcrest.library.number.ordering_comparison.less_than(value)¶
Matches if object is less than a given value.
- Parameters
value (Any) – The value to compare against.
- Return type