def does_not_modify_other_keys_in_errors_dict(validator):
 def call_and_assert(key, data, errors, context=None):
  if (context is None):
   context = {}
  original_data = copy.deepcopy(data)
  original_errors = copy.deepcopy(errors)
  original_context = copy.deepcopy(context)
  result = validator(key, data, errors, context=context)
  if (key in errors):
   del errors[key]
  if (key in original_errors):
   del original_errors[key]
  assert (errors.keys() == original_errors.keys()), 'Should not add or remove keys from errors dict when called with key: {key}, data: {data}, errors: {errors}, context: {context}'.format(key=key, data=original_data, errors=original_errors, context=original_context)
  for key_ in errors:
   assert (errors[key_] == original_errors[key_]), 'Should not modify other keys in errors dict when called with key: {key}, data: {data}, errors: {errors}, context: {context}'.format(key=key, data=original_data, errors=original_errors, context=original_context)
  return result
 return call_and_assert

def does_not_modify_other_keys_in_errors_dict ( validator ) : def call_and_assert ( key , data , errors , context = None ) : if ( context is None ) : context = { } original_data = copy . deepcopy ( data ) original_errors = copy . deepcopy ( errors ) original_context = copy . deepcopy ( context ) result = validator ( key , data , errors , context = context ) if ( key in errors ) : del errors [ key ] if ( key in original_errors ) : del original_errors [ key ] assert ( errors . keys ( ) == original_errors . keys ( ) ) , 'Should not add or remove keys from errors dict when called with key: {key}, data: {data}, errors: {errors}, context: {context}' . format ( key = key , data = original_data , errors = original_errors , context = original_context ) for key_ in errors : assert ( errors [ key_ ] == original_errors [ key_ ] ) , 'Should not modify other keys in errors dict when called with key: {key}, data: {data}, errors: {errors}, context: {context}' . format ( key = key , data = original_data , errors = original_errors , context = original_context ) return result return call_and_assert
a decorator that asserts that the decorated validator doesnt add .