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