def test_is_not_null_throws_error_on_null_value(): """ Tests that the `is_not_null()` method throws an ArgumentError when it is supplied with a None (Null) value. """ # Arrange value = None validator = StringValidator(value, 'value') # Assert with pytest.raises(ArgumentNullError): # Act validator.is_not_null()
def test_is_not_null_accepts_valid_value(value: str): """ Tests that the `is_not_null()` method does not throw an ArgumentError when it is supplied with a valid value. """ # Arrange validator = StringValidator(value, 'value') # Act try: validator.is_not_null() # Assert except ArgumentNullError: pytest.fail(f'`{value}` should not have been None (Null), but an error occurred instead.')
def test_is_not_null_returns_validator_self(): """ Tests if the `is_not_null()` validator method returns itself after the validation is performed, so that additional validations can be performed. """ # Arrange value = 'test' validator = StringValidator(value, 'value') # Act validator_returned = validator.is_not_null() # Assert assert validator_returned is validator