parameters: (input_json)
return_statement: return output
docstring: Read json input and return a dictionary with information necessary to produce the xunit output
docstring_summary: Read json input and return a dictionary with information necessary to produce the xunit output
docstring_tokens: Read json input and return a dictionary with information necessary to produce the xunit output
function: def transform(input_json):
      """Read json input and return a dictionary with information necessary to produce the xunit output"""
  
      output = collections.defaultdict(
          lambda: {'xml': '', 'test_count': 0, 'failure_count': 0})
      test_results = input_json['per_iteration_data'][0]
      for test_fullname, iterations in test_results.items():
          delim = '#' if '#' in test_fullname else '/' if '/' in test_fullname else '.'
          test_suite, test_case = test_fullname.rsplit(delim, maxsplit=1)
          iteration = pick_iteration(test_case, iterations)
  
          output[test_suite]['test_count'] += 1
          output[test_suite][
              'xml'] += f'<testcase name="{test_case}" time="{int(iteration["elapsed_time_ms"])/100.0}">'
          if iteration['status'] == 'SUCCESS':
              if iteration['output_snippet']:
                  sanitized_output = ''.join(
                      filter(lambda x: x in printable, iteration['output_snippet']))
                  output[test_suite]['xml'] += f"<system-out><![CDATA[{sanitized_output}]]></system-out>"
          else:
              output[test_suite]['failure_count'] += 1
              sanitized_output = ''.join(
                  filter(lambda x: x in printable, iteration['output_snippet']))
              output[test_suite][
                  'xml'] += f'<failure message="failed"><![CDATA[{sanitized_output}]]></failure>'
          output[test_suite]['xml'] += "</testcase>"
      return output
function_tokens: def transform ( input_json ) : output = collections . defaultdict ( lambda : { 'xml' : '' , 'test_count' : 0 , 'failure_count' : 0 } ) test_results = input_json [ 'per_iteration_data' ] [ 0 ] for test_fullname , iterations in test_results . items ( ) : delim = '#' if '#' in test_fullname else '/' if '/' in test_fullname else '.' test_suite , test_case = test_fullname . rsplit ( delim , maxsplit = 1 ) iteration = pick_iteration ( test_case , iterations ) output [ test_suite ] [ 'test_count' ] += 1 output [ test_suite ] [ 'xml' ] += f'<testcase name="{test_case}" time="{int(iteration["elapsed_time_ms"])/100.0}">' if iteration [ 'status' ] == 'SUCCESS' : if iteration [ 'output_snippet' ] : sanitized_output = '' . join ( filter ( lambda x : x in printable , iteration [ 'output_snippet' ] ) ) output [ test_suite ] [ 'xml' ] += f"<system-out><![CDATA[{sanitized_output}]]></system-out>" else : output [ test_suite ] [ 'failure_count' ] += 1 sanitized_output = '' . join ( filter ( lambda x : x in printable , iteration [ 'output_snippet' ] ) ) output [ test_suite ] [ 'xml' ] += f'<failure message="failed"><![CDATA[{sanitized_output}]]></failure>' output [ test_suite ] [ 'xml' ] += "</testcase>" return output