testing/unexpected_passes_common/result_output.py
def _RecursiveHtmlToFile(element, file_handle):
  """Recursively outputs |element| as HTMl to |file_handle|.

  Iterables will be output as a collapsible section containing any of the
  iterable's contents.

  Any link-like text will be turned into anchor tags.

  Args:
    element: A dict, list, or str/unicode to output.
    file_handle: An open file-like object to output to.
  """
  if isinstance(element, six.string_types):
    file_handle.write('<p>%s</p>\n' % _LinkifyString(element))
  elif isinstance(element, dict):
    for k, v in element.items():
      html_class = 'collapsible_group'
      # This allows us to later (in JavaScript) recursively highlight sections
      # that are likely of interest to the user, i.e. whose expectations can be
      # modified.
      if k and FULL_PASS in k:
        html_class = 'highlighted_collapsible_group'
      file_handle.write('<button type="button" class="%s">%s</button>\n' %
                        (html_class, k))
      file_handle.write('<div class="content">\n')
      _RecursiveHtmlToFile(v, file_handle)
      file_handle.write('</div>\n')
  elif isinstance(element, list):
    for i in element:
      _RecursiveHtmlToFile(i, file_handle)
  else:
    raise RuntimeError('Given unhandled type %s' % type(element))
Recursively outputs |element| as HTMl to |file_handle|.

  Iterables will be output as a collapsible section containing any of the
  iterable's contents.

  Any link-like text will be turned into anchor tags.

  Args:
    element: A dict, list, or str/unicode to output.
    file_handle: An open file-like object to output to.
  
Recursively outputs |element| as HTMl to |file_handle|.
Iterables will be output as a collapsible section containing any of the
iterable's contents.

Any link-like text will be turned into anchor tags.
Recursively outputs |element| as HTMl to |file_handle| . Iterables will be output as a collapsible section containing any of the iterable ' s contents . Any link - like text will be turned into anchor tags .
def _RecursiveHtmlToFile(element, file_handle):
  if isinstance(element, six.string_types):
    file_handle.write('<p>%s</p>\n' % _LinkifyString(element))
  elif isinstance(element, dict):
    for k, v in element.items():
      html_class = 'collapsible_group'
      if k and FULL_PASS in k:
        html_class = 'highlighted_collapsible_group'
      file_handle.write('<button type="button" class="%s">%s</button>\n' %
                        (html_class, k))
      file_handle.write('<div class="content">\n')
      _RecursiveHtmlToFile(v, file_handle)
      file_handle.write('</div>\n')
  elif isinstance(element, list):
    for i in element:
      _RecursiveHtmlToFile(i, file_handle)
  else:
    raise RuntimeError('Given unhandled type %s' % type(element))
def _RecursiveHtmlToFile ( element , file_handle ) : if isinstance ( element , six . string_types ) : file_handle . write ( '<p>%s</p>\n' % _LinkifyString ( element ) ) elif isinstance ( element , dict ) : for k , v in element . items ( ) : html_class = 'collapsible_group' if k and FULL_PASS in k : html_class = 'highlighted_collapsible_group' file_handle . write ( '<button type="button" class="%s">%s</button>\n' % ( html_class , k ) ) file_handle . write ( '<div class="content">\n' ) _RecursiveHtmlToFile ( v , file_handle ) file_handle . write ( '</div>\n' ) elif isinstance ( element , list ) : for i in element : _RecursiveHtmlToFile ( i , file_handle ) else : raise RuntimeError ( 'Given unhandled type %s' % type ( element ) )
Recursively outputs |element| as HTMl to |file_handle|.
Recursively outputs |element| as HTMl to |file_handle| .
"""Recursively outputs |element| as HTMl to |file_handle|.

  Iterables will be output as a collapsible section containing any of the
  iterable's contents.

  Any link-like text will be turned into anchor tags.

  Args:
    element: A dict, list, or str/unicode to output.
    file_handle: An open file-like object to output to.
  """ # This allows us to later (in JavaScript) recursively highlight sections # that are likely of interest to the user, i.e. whose expectations can be # modified.
element
A dict, list, or str/unicode to output.
A dict list or str / unicode to output .
file_handle
An open file-like object to output to.
An open file - like object to output to .