def test_is_not_in_set_throws_error_on_matching_set(value: str, set: list): """ Tests that the `is_not_in_set()` method throws an ArgumentError when its value is present in the supplied set. """ # Arrange validator = StringValidator(value, 'value') # Assert with pytest.raises(ArgumentError): # Act validator.is_not_in_set(set)
def test_is_not_in_set_accepts_value_not_in_set(value: str, set: list): """ Tests that the `is_not_in_set()` method accepts when its value is not present in the supplied set. """ # Arrange validator = StringValidator(value, 'value') # Act try: validator.is_not_in_set(set) # Assert except ArgumentError: pytest.fail(f'`{value}` should be in the set `{set}`, but an error occurred.')
def test_is_not_in_set_returns_validator_self(): """ Tests if the `is_not_in_set()` validator method returns itself after the validation is performed, so that additional validations can be performed. """ # Arrange value = '1234' set = ['test'] validator = StringValidator(value, 'value') # Act validator_returned = validator.is_not_in_set(set) # Assert assert validator_returned is validator