def adds_message_to_errors_dict(error_message):
 def decorator(validator):
  def call_and_assert(key, data, errors, context):
   result = validator(key, data, errors, context)
   assert (errors[key] == [error_message]), 'Should add message to errors dict: {msg}'.format(msg=error_message)
   return result
  return call_and_assert
 return decorator

def adds_message_to_errors_dict ( error_message ) : def decorator ( validator ) : def call_and_assert ( key , data , errors , context ) : result = validator ( key , data , errors , context ) assert ( errors [ key ] == [ error_message ] ) , 'Should add message to errors dict: {msg}' . format ( msg = error_message ) return result return call_and_assert return decorator
a decorator that asserts the the decorated validator adds a given error message to the errors dict .