def test_is_greater_or_equal_throws_error_on_less_than_value( value: number, min_value: number): """ Tests that the `is_greater_or_equal()` method throws an ArgumentOutOfRangeError when it is supplied with a value that is less than the minimum value. """ # Arrange validator = NumberValidator(value, "value") # Assert with pytest.raises(ArgumentOutOfRangeError): # Act validator.is_greater_or_equal(min_value)
def test_is_greater_or_equal_accepts_equal_value(value: number, min_value: number): """ Tests that the `is_greater_or_equal()` method does not throw an ArgumentOutOfRangeError when it is supplied with a value that is equal to the minimum value. """ # Arrange validator = NumberValidator(value, "value") # Act try: validator.is_greater_or_equal(min_value) # Assert except ArgumentOutOfRangeError: pytest.fail( f'`{value}` should be greater than or equal to `{min_value}`, but an error occurred.' )
def test_is_greater_or_equal_returns_validator_self(): """ Tests if the `is_greater_or_equal()` validator method returns itself after the validation is performed, so that additional validations can be performed. """ # Arrange validator = NumberValidator(5, "value") # Act validator_returned = validator.is_greater_or_equal(1) # Assert assert validator_returned is validator