def test_does_not_equal_throws_error_on_equal_value(): """ Tests that the `does_not_equal()` method throws an ArgumentError when the value is equal to the specified value. """ # Arrange value = 'Hello World!' validator = StringValidator(value, 'value') # Assert with pytest.raises(ArgumentError): # Act validator.does_not_equal(value)
def test_does_not_equal_accepts_notequal_value(): """ Tests that the `does_not_equal()` method does not throw an ArgumentError when the value is not equal to the specified value. """ # Arrange value = 'Hello World!' not_equals = 'Test' validator = StringValidator(value, 'value') # Act try: validator.does_not_equal(not_equals) # Assert except ArgumentError: pytest.fail()
def test_does_not_equal_returns_validator_self(): """ Tests if the `does_not_equal()` validator method returns itself after the validation is performed, so that additional validations can be performed. """ # Arrange value = 'test' not_equal = 'Hello' validator = StringValidator(value, 'value') # Act validator_returned = validator.does_not_equal(not_equal) # Assert assert validator_returned is validator