parameters: (doc, n_attrs, n_sum_md_names, n_sum_mds)
return_statement: return True
docstring: Check that entity document was updated correctly at DB.
  
      :param doc: the doc to check
      :param n_attrs: the expected number of attributes in attrNames vector
      :param n_sum_md_names: the expected sum of elements in mdNames vectors
      :param n_sum_mds: the expected sum of elements in md key-maps
      :return: True if the check is ok, False otherwise
docstring_summary: Check that entity document was updated correctly at DB.
docstring_tokens: Check that entity document was updated correctly at DB .
function: def update_ok(doc, n_attrs, n_sum_md_names, n_sum_mds):
      """
      Check that entity document was updated correctly at DB.
  
      :param doc: the doc to check
      :param n_attrs: the expected number of attributes in attrNames vector
      :param n_sum_md_names: the expected sum of elements in mdNames vectors
      :param n_sum_mds: the expected sum of elements in md key-maps
      :return: True if the check is ok, False otherwise
      """
  
      if (not ATTRS in doc):
          print "debug1"
          return False
  
      ck_attrs = len(doc[ATTRS].keys())
  
      ck_sum_md_names = 0
      ck_sum_mds      = 0 
      for attr in doc[ATTRS].keys():
  
          # By construction, mdNames is always there (sometimes empty), but mds may be or not
          md_names = doc[ATTRS][attr][MD_NAMES]
          ck_sum_md_names += len(md_names)
  
          if MDS in doc[ATTRS][attr].keys():        
              mds         = doc[ATTRS][attr][MDS]            
              ck_sum_mds  += len(mds.keys())
  
  
      if (n_attrs != ck_attrs or n_sum_md_names != ck_sum_md_names or n_sum_mds != ck_sum_mds):
          print "debug 2: %d %d %d %d %d %d" % (ck_attrs, n_attrs, n_sum_md_names, ck_sum_md_names, n_sum_mds, ck_sum_mds)
          return False
  
      return True
function_tokens: def update_ok ( doc , n_attrs , n_sum_md_names , n_sum_mds ) : if ( not ATTRS in doc ) : print "debug1" return False ck_attrs = len ( doc [ ATTRS ] . keys ( ) ) ck_sum_md_names = 0 ck_sum_mds = 0 for attr in doc [ ATTRS ] . keys ( ) : # By construction, mdNames is always there (sometimes empty), but mds may be or not md_names = doc [ ATTRS ] [ attr ] [ MD_NAMES ] ck_sum_md_names += len ( md_names ) if MDS in doc [ ATTRS ] [ attr ] . keys ( ) : mds = doc [ ATTRS ] [ attr ] [ MDS ] ck_sum_mds += len ( mds . keys ( ) ) if ( n_attrs != ck_attrs or n_sum_md_names != ck_sum_md_names or n_sum_mds != ck_sum_mds ) : print "debug 2: %d %d %d %d %d %d" % ( ck_attrs , n_attrs , n_sum_md_names , ck_sum_md_names , n_sum_mds , ck_sum_mds ) return False return True