def test_intg_rqr_is_negative_throws_error_on_positive_number(value: number): """ Tests the `is_negative()` requires validator method does not throw an ArgumentOutOfRangeError when the value is a positive number. """ # Assert with pytest.raises(ArgumentOutOfRangeError): # Act Condition.requires_num(value, 'value').is_negative()
def test_intg_rqr_is_negative_accepts_negative_number(value: number): """ Tests the `is_negative()` requires validator method does not throw an ArgumentOutOfRangeError when the value is a negative number. """ # Act try: Condition.requires_num(value, 'value').is_negative() # Assert except ArgumentOutOfRangeError: pytest.fail()
def test_intg_rqr_is_less_or_equal_throws_error_on_greater_than_value( value: number, max_value: number ): """ Tests the `is_less_or_equal()` requires validator method through `Condition.requires_num()` to see if it, throws an ArgumentOutOfRangeError when it is supplied with a value that is greater than the maximum value. """ # Assert with pytest.raises(ArgumentOutOfRangeError): # Act Condition.requires_num(value, 'value').is_less_or_equal(max_value)
def test_intg_rqr_is_not_equal_to_throws_error_on_invalid_value( value: number, not_equal_to: number ): """ Tests the `is_not_equal()` requires validator method through `Condition.requires_num()` to see if it, throws an ArgumentOutOfRangeError when it is supplied with a value that is equal to the not equal value. """ # Assert with pytest.raises(ArgumentOutOfRangeError): # Act Condition.requires_num(value, 'value').is_not_equal_to(not_equal_to)
def test_intg_rqr_is_not_in_range_throws_error_on_invalid_range( value: number, min_value: number, max_value: number ): """ Tests the `is_not_in_range()` requires validator method through `Condition.requires_num()` to see if it, throws an ArgumentOutOfRangeError when it is supplied with a value in the supplied range. """ # Assert with pytest.raises(ArgumentOutOfRangeError): # Act Condition.requires_num(value, 'value').is_not_in_range(min_value, max_value)
def test_intg_rqr_is_not_equal_to_accepts_valid_value( value: number, equal_to: number ): """ Tests the `is_not_equal()` requires validator method through `Condition.requires_num()` to see if it, does not throw an ArgumentOutOfRangeError when it is supplied with a value that is not equal to the not equal value. """ # Act try: Condition.requires_num(value, 'value').is_not_equal_to(equal_to) # Assert except ArgumentOutOfRangeError: pytest.fail()
def test_intg_rqr_is_less_or_equal_accepts_less_than_value( value: number, max_value: number ): """ Tests the `is_less_or_equal()` requires validator method through `Condition.requires_num()` to see if it, does not throw an ArgumentOutOfRangeError when it is supplied with a value that is less than the maximum value. """ # Act try: Condition.requires_num(value, 'value').is_less_or_equal(max_value) # Assert except ArgumentOutOfRangeError: pytest.fail(f'`{value}` should be less than or equal to `{max_value}`, but instead an error occurred.')
def test_intg_rqr_is_in_range_accepts_valid_range( value: number, min_value: number, max_value: number ): """ Tests the `is_in_range()` requires validator method through `Condition.requires_num()` to see if it, does not throw an ArgumentOutOfRangeError when it is suppied with a value that is within the supplied range. """ # Act try: Condition.requires_num(value, 'value').is_in_range(min_value, max_value) # Assert except ArgumentOutOfRangeError: pytest.fail(f'`{value}` should have been accepted in the range `{min_value}-{max_value}`, but instead an error occurred.')
def test_requires_returns_number_validator(value: number): """ Tests if the `Condition.requires()` method returns the validator that is appropriate to the number (float, int) datatype. """ # Act validator = Condition.requires_num(value, 'value') # Assert assert isinstance(validator, NumberValidator)
def test_intg_rqr_prnt_get_value_returns_value(value): """ Tests if the parent `get_value()` requires validator method returns the value saved in the validator. """ # Act actual = Condition.requires_num(value, 'value').get_value() # Assert assert actual == value assert actual is value assert type(actual) == type(value)