def test_intg_rqr_is_null_throws_error_on_invalid_value(value: str): """ Tests the `is_null()` through `Condition.requires_str()` to see if it, throws an ArgumentError when it is supplied with an invalid value. """ # Assert with pytest.raises(ArgumentNullError): # Act Condition.requires_str(value, 'value').is_null()
def test_intg_rqr_does_not_have_length_throws_error_on_equal_length( value: str, length: int): """ Tests the `does_not_have_length()` through `Condition.requires_str()` to see if it, throws an ArgumentError when it is supplied with a equal length. """ # Assert with pytest.raises(ArgumentError): # Act Condition.requires_str(value, 'value').does_not_have_length(length)
def test_intg_rqr_does_not_end_with_throws_error_on_invalid_value( value: str, ends_with: str): """ Tests the `does_not_end_with()` through `Condition.requires_str()` to see if it, throws an ArgumentError when the value ends with the specified value. """ # Assert with pytest.raises(ArgumentError): # Act Condition.requires_str(value, 'value').does_not_end_with(ends_with)
def test_intg_rqr_is_not_regex_match_throws_error_on_matching_pattern( value: str, pattern: str): """ Tests the `is_not_regex_match()` requires validator method through `Condition.requires_str()` to see if it, throws an ArgumentError when the value matches the specified pattern. """ # Assert with pytest.raises(ArgumentPatternError): # Act Condition.requires_str(value, 'value').is_not_regex_match(pattern)
def test_intg_rqr_does_not_contain_throw_error_on_invalid_value( value: str, contains: str): """ Tests the `does_not_contain()` through `Condition.requires_str()` to see if it, throws an ArgumentError when the value contains specified value. """ # Assert with pytest.raises(ArgumentError): # Act Condition.requires_str(value, 'value').does_not_contain(contains)
def test_intg_rqr_is_longer_or_equal_throws_error_on_shorter_length( value: str, min_length: int): """ Tests the `is_longer_or_equal()` through `Condition.requires_str()` to see if it, throws an ArgumentError when it is supplied with a shorter length. """ # Assert with pytest.raises(ArgumentError): # Act Condition.requires_str(value, 'value').is_longer_or_equal(min_length)
def test_intg_rqr_is_not_null_or_whitespace_throw_error_on_null_value(): """ Tests the `is_not_null_or_whitespace()` through `Condition.requires_str()` to see if it, throws an ArgumentError when it is supplied with a None (Null) value. """ # Arrange value = None # Assert with pytest.raises(ArgumentError): # Act Condition.requires_str(value, 'value').is_not_null_or_whitespace()
def test_intg_rqr_is_null_or_empty_throws_error_on_whitespace_value(): """ Tests the `is_null_or_empty()` through `Condition.requires_str()` to see if it, throws an ArgumentError when it is supplied with a whitespace value. """ # Arrange value = WHITESPACE_STRING # Assert with pytest.raises(ArgumentError): # Act Condition.requires_str(value, 'value').is_null_or_empty()
def test_intg_rqr_contains_accepts_valid_value(value: str, contains: str): """ Tests the `contains()` through `Condition.requires_str()` to see if it, does not throw an ArgumentError when the value does contains specified value. """ # Act try: Condition.requires_str(value, 'value').contains(contains) # Assert except ArgumentError: pytest.fail( f'`{value}` should contain `{contains}`, but an error occurred.')
def test_intg_rqr_is_null_throws_error_on_empty_value(): """ Tests the `is_null()` through `Condition.requires_str()` to see if it, throws an ArgumentError when it is supplied with an empty value. """ # Arrange value = EMPTY_STRING # Assert with pytest.raises(ArgumentNullError): # Act Condition.requires_str(value, 'value').is_null()
def test_intg_rqr_ends_with_accepts_valid_value(value: str, ends_with: str): """ Tests the `ends_with()` through `Condition.requires_str()` to see if it, does not throw an ArgumentError when the value ends with the specified value. """ # Act try: Condition.requires_str(value, 'value').ends_with(ends_with) # Assert except ArgumentError: pytest.fail( f'`{value}` should end with `{ends_with}`, but an error occurred.')
def test_intg_rqr_does_not_equal_throws_error_on_equal_value(): """ Tests the `equals()` requires validator method throws an ArgumentError when the value is not equal to the specified value. """ # Arrange value = 'Hello World!' # Assert with pytest.raises(ArgumentError): # Act Condition.requires_str(value, 'value').does_not_equal(value)
def test_intg_rqr_has_length_accepts_equal_length(value: str, length: int): """ Tests the `has_length()` through `Condition.requires_str()` to see if it, does not throw an ArgumentError when it is supplied with a equal length. """ # Act try: Condition.requires_str(value, 'value').has_length(length) # Assert except ArgumentError: pytest.fail( f'`{value}` should have the length `{length}`, but an error occurred.' )
def test_intg_rqr_is_not_null_or_whitespace_accepts_valid_value(value: str): """ Tests the `is_not_null_or_whitespace()` through `Condition.requires_str()` to see if it, does not throw an ArgumentError when it is supplied with a valid value. """ # Assert try: Condition.requires_str(value, 'value').is_not_null_or_whitespace() # Assert except (ArgumentError, ArgumentNullError): pytest.fail( f'`{value}` should not have been None (Null) or empty, but an error occurred instead.' )
def test_intg_rqr_equals_accepts_equal_value(): """ Tests the `equals()` requires validator method does not throw an ArgumentError when the value is equal to the specified value. """ # Arrange value = 'Hello World!' # Act try: Condition.requires_str(value, 'value').equals(value) # Assert except ArgumentError: pytest.fail()
def test_intg_rqr_is_not_regex_match_accepts_not_matching_pattern( value: str, pattern: str): """ Tests the `is_not_regex_match()` through `Condition.requires_str()` to see if it, does not throw an ArgumentError when the value does not match the specified pattern. """ # Act try: Condition.requires_str(value, 'value').is_not_regex_match(pattern) # Assert except ArgumentPatternError: pytest.fail( f'`{value}` should match the pattern `{pattern}`, but an error occurred.' )
def test_intg_rqr_is_shorter_than_accepts_shorter_length( value: str, max_length: int): """ Tests the `is_shorter_than()` through `Condition.requires_str()` to see if it, does not throw an ArgumentError when it is supplied with a shorter length. """ # Act try: Condition.requires_str(value, 'value').is_shorter_than(max_length) # Assert except ArgumentError: pytest.fail( f'`{value}` should be shorter than `{max_length}`, but an error occurred.' )
def test_intg_rqr_is_longer_or_equal_accepts_equal_length( value: str, min_length: int): """ Tests the `is_longer_or_equal()` through `Condition.requires_str()` to see if it, does not throw an ArgumentError when it is supplied with a equal length. """ # Act try: Condition.requires_str(value, 'value').is_longer_or_equal(min_length) # Assert except ArgumentError: pytest.fail( f'`{value}` should be longer or equal to `{min_length}`, but an error occurred.' )
def test_intg_rqr_is_not_null_accepts_whitespace_value(): """ Tests the `is_not_null()` through `Condition.requires_str()` to see if it, throws an ArgumentError when it is supplied with a whitespace value. """ # Arrange value = WHITESPACE_STRING # Act try: Condition.requires_str(value, 'value').is_not_null() # Assert except ArgumentNullError: pytest.fail( f'`{value}` should not have been None (Null), but an error occurred instead.' )
def test_intg_rqr_is_null_or_empty_accepts_null_value(): """ Tests the `is_null_or_empty()` through `Condition.requires_str()` to see if it, does not throw an ArgumentError when it is supplied with a None (Null) value. """ # Arrange value = None # Act try: Condition.requires_str(value, 'value').is_null_or_empty() # Assert except ArgumentNullError: pytest.fail( f'`{value}` should have been None (Null) or empty, but an error occurred instead.' )
def test_intg_rqr_is_null_or_whitespace_accepts_empty_value(): """ Tests the `is_not_null_or_whitespace()` through `Condition.requires_str()` to see if it, does not throw an ArgumentError when it is supplied with a empty value. """ # Arrange value = EMPTY_STRING # Act try: Condition.requires_str(value, 'value').is_null_or_whitespace() # Assert except ArgumentError: pytest.fail( f'`{value}` should have been None (Null), empty or whitespace, but an error occurred instead.' )
def test_requires_returns_string_validator(value: str): """ Tests if the `Condition.requires_str()` method returns the validator that is appropriate to the string datatype. """ # Act validator = Condition.requires_str(value, 'value') # Assert assert isinstance(validator, StringValidator)
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_str(value, 'value').get_value() # Assert assert actual == value assert actual is value assert type(actual) == type(value)
def test_intg_rqr_is_not_in_set_case_insensitive_throws_error_on_matching_set( value: str, set: list): """ Tests the `is_not_in_set_case_insensitive()` requires validator method throws an ArgumentError when its value is present in the supplied set, case insensitive. """ # Arrange validator = Condition.requires_str(value, 'value') # Assert with pytest.raises(ArgumentError): # Act validator.is_not_in_set_case_insensitive(set)
def test_intg_rqr_is_in_set_accepts_value_in_set(value: str, set: list): """ Tests the `is_in_set()` requires validator method does not throw an ArgumentError when its value is present in the supplied set. """ # Arrange validator = Condition.requires_str(value, 'value') # Act try: validator.is_in_set(set) # Assert except ArgumentError: pytest.fail( f'`{value}` should be in the set `{set}`, but an error occurred.')