def test_file_path_validator_with_valid_paths(actual_path): validator = io_utils.file_type_validator([".yml", ".yaml"], "error message") document = Document(actual_path) # If the path is valid there shouldn't be an exception assert validator.validate(document) is None
def test_file_path_validator_with_invalid_paths(actual_path): test_error_message = actual_path validator = io_utils.file_type_validator([".yml"], test_error_message) document = Document(actual_path) with pytest.raises(ValidationError) as e: validator.validate(document) assert e.value.message == test_error_message