def test_is_in_set_throws_error_on_non_matching_set(value: str, set: list): """ Tests that the `is_in_set()` method throws an ArgumentError when its value is not present in the supplied set. """ # Arrange validator = StringValidator(value, 'value') # Assert with pytest.raises(ArgumentError): # Act validator.is_in_set(set)
def test_is_in_set_accepts_value_in_set(value: str, set: list): """ Tests that the `is_in_set()` method does not throw an ArgumentError when its value is present in the supplied set. """ # Arrange validator = StringValidator(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.')
def test_is_in_set_returns_validator_self(): """ Tests if the `is_in_set()` validator method returns itself after the validation is performed, so that additional validations can be performed. """ # Arrange value = '1234' set = ['1234'] validator = StringValidator(value, 'value') # Act validator_returned = validator.is_in_set(set) # Assert assert validator_returned is validator