parameters: (self, test_keys)
return_statement: return [e for e in entities if e is not None]
docstring: Gets the TestMetadata, Bot, and Master entities preceding in path.
docstring_summary: Gets the TestMetadata, Bot, and Master entities preceding in path.
docstring_tokens: Gets the TestMetadata Bot and Master entities preceding in path .
function: def _GetTestAncestors(self, test_keys):
      """Gets the TestMetadata, Bot, and Master entities preceding in path."""
      entities = []
      added_parents = set()
      for test_key in test_keys:
        if test_key.kind() != 'TestMetadata':
          continue
        parts = utils.TestPath(test_key).split('/')
        for index, _, in enumerate(parts):
          test_path = '/'.join(parts[:index + 1])
          if test_path in added_parents:
            continue
          added_parents.add(test_path)
          if index == 0:
            entities.append(ndb.Key('Master', parts[0]).get())
          elif index == 1:
            entities.append(ndb.Key('Master', parts[0], 'Bot', parts[1]).get())
          else:
            entities.append(ndb.Key('TestMetadata', test_path).get())
      return [e for e in entities if e is not None]
function_tokens: def _GetTestAncestors ( self , test_keys ) : entities = [ ] added_parents = set ( ) for test_key in test_keys : if test_key . kind ( ) != 'TestMetadata' : continue parts = utils . TestPath ( test_key ) . split ( '/' ) for index , _ , in enumerate ( parts ) : test_path = '/' . join ( parts [ : index + 1 ] ) if test_path in added_parents : continue added_parents . add ( test_path ) if index == 0 : entities . append ( ndb . Key ( 'Master' , parts [ 0 ] ) . get ( ) ) elif index == 1 : entities . append ( ndb . Key ( 'Master' , parts [ 0 ] , 'Bot' , parts [ 1 ] ) . get ( ) ) else : entities . append ( ndb . Key ( 'TestMetadata' , test_path ) . get ( ) ) return [ e for e in entities if e is not None ]