testing/unexpected_passes_common/result_output.py
def _ConvertTestExpectationMapToStringDict(test_expectation_map):
  """Converts |test_expectation_map| to a dict of strings for reporting.

  Args:
    test_expectation_map: A data_types.TestExpectationMap.

  Returns:
    A string dictionary representation of |test_expectation_map| in the
    following format:
    {
      expectation_file: {
        test_name: {
          expectation_summary: {
            builder_name: {
              'Fully passed in the following': [
                step1,
              ],
              'Partially passed in the following': {
                step2: [
                  failure_link,
                ],
              },
              'Never passed in the following': [
                step3,
              ],
            }
          }
        }
      }
    }
  """
  assert isinstance(test_expectation_map, data_types.TestExpectationMap)
  output_dict = {}
  # This initially looks like a good target for using
  # data_types.TestExpectationMap's iterators since there are many nested loops.
  # However, we need to reset state in different loops, and the alternative of
  # keeping all the state outside the loop and resetting under certain
  # conditions ends up being less readable than just using nested loops.
  for expectation_file, expectation_map in test_expectation_map.items():
    output_dict[expectation_file] = {}

    for expectation, builder_map in expectation_map.items():
      test_name = expectation.test
      expectation_str = _FormatExpectation(expectation)
      output_dict[expectation_file].setdefault(test_name, {})
      output_dict[expectation_file][test_name][expectation_str] = {}

      for builder_name, step_map in builder_map.items():
        output_dict[expectation_file][test_name][expectation_str][
            builder_name] = {}
        fully_passed = []
        partially_passed = {}
        never_passed = []

        for step_name, stats in step_map.items():
          if stats.NeverNeededExpectation(expectation):
            fully_passed.append(AddStatsToStr(step_name, stats))
          elif stats.AlwaysNeededExpectation(expectation):
            never_passed.append(AddStatsToStr(step_name, stats))
          else:
            assert step_name not in partially_passed
            partially_passed[step_name] = stats

        output_builder_map = output_dict[expectation_file][test_name][
            expectation_str][builder_name]
        if fully_passed:
          output_builder_map[FULL_PASS] = fully_passed
        if partially_passed:
          output_builder_map[PARTIAL_PASS] = {}
          for step_name, stats in partially_passed.items():
            s = AddStatsToStr(step_name, stats)
            output_builder_map[PARTIAL_PASS][s] = list(stats.failure_links)
        if never_passed:
          output_builder_map[NEVER_PASS] = never_passed
  return output_dict
Converts |test_expectation_map| to a dict of strings for reporting.

  Args:
    test_expectation_map: A data_types.TestExpectationMap.

  Returns:
    A string dictionary representation of |test_expectation_map| in the
    following format:
    {
      expectation_file: {
        test_name: {
          expectation_summary: {
            builder_name: {
              'Fully passed in the following': [
                step1,
              ],
              'Partially passed in the following': {
                step2: [
                  failure_link,
                ],
              },
              'Never passed in the following': [
                step3,
              ],
            }
          }
        }
      }
    }
  
Converts |test_expectation_map| to a dict of strings for reporting.
Converts |test_expectation_map| to a dict of strings for reporting .
def _ConvertTestExpectationMapToStringDict(test_expectation_map):
  assert isinstance(test_expectation_map, data_types.TestExpectationMap)
  output_dict = {}
  for expectation_file, expectation_map in test_expectation_map.items():
    output_dict[expectation_file] = {}
    for expectation, builder_map in expectation_map.items():
      test_name = expectation.test
      expectation_str = _FormatExpectation(expectation)
      output_dict[expectation_file].setdefault(test_name, {})
      output_dict[expectation_file][test_name][expectation_str] = {}
      for builder_name, step_map in builder_map.items():
        output_dict[expectation_file][test_name][expectation_str][
            builder_name] = {}
        fully_passed = []
        partially_passed = {}
        never_passed = []
        for step_name, stats in step_map.items():
          if stats.NeverNeededExpectation(expectation):
            fully_passed.append(AddStatsToStr(step_name, stats))
          elif stats.AlwaysNeededExpectation(expectation):
            never_passed.append(AddStatsToStr(step_name, stats))
          else:
            assert step_name not in partially_passed
            partially_passed[step_name] = stats
        output_builder_map = output_dict[expectation_file][test_name][
            expectation_str][builder_name]
        if fully_passed:
          output_builder_map[FULL_PASS] = fully_passed
        if partially_passed:
          output_builder_map[PARTIAL_PASS] = {}
          for step_name, stats in partially_passed.items():
            s = AddStatsToStr(step_name, stats)
            output_builder_map[PARTIAL_PASS][s] = list(stats.failure_links)
        if never_passed:
          output_builder_map[NEVER_PASS] = never_passed
  return output_dict
def _ConvertTestExpectationMapToStringDict ( test_expectation_map ) : assert isinstance ( test_expectation_map , data_types . TestExpectationMap ) output_dict = { } for expectation_file , expectation_map in test_expectation_map . items ( ) : output_dict [ expectation_file ] = { } for expectation , builder_map in expectation_map . items ( ) : test_name = expectation . test expectation_str = _FormatExpectation ( expectation ) output_dict [ expectation_file ] . setdefault ( test_name , { } ) output_dict [ expectation_file ] [ test_name ] [ expectation_str ] = { } for builder_name , step_map in builder_map . items ( ) : output_dict [ expectation_file ] [ test_name ] [ expectation_str ] [ builder_name ] = { } fully_passed = [ ] partially_passed = { } never_passed = [ ] for step_name , stats in step_map . items ( ) : if stats . NeverNeededExpectation ( expectation ) : fully_passed . append ( AddStatsToStr ( step_name , stats ) ) elif stats . AlwaysNeededExpectation ( expectation ) : never_passed . append ( AddStatsToStr ( step_name , stats ) ) else : assert step_name not in partially_passed partially_passed [ step_name ] = stats output_builder_map = output_dict [ expectation_file ] [ test_name ] [ expectation_str ] [ builder_name ] if fully_passed : output_builder_map [ FULL_PASS ] = fully_passed if partially_passed : output_builder_map [ PARTIAL_PASS ] = { } for step_name , stats in partially_passed . items ( ) : s = AddStatsToStr ( step_name , stats ) output_builder_map [ PARTIAL_PASS ] [ s ] = list ( stats . failure_links ) if never_passed : output_builder_map [ NEVER_PASS ] = never_passed return output_dict
Converts |test_expectation_map| to a dict of strings for reporting.
Converts |test_expectation_map| to a dict of strings for reporting .
"""Converts |test_expectation_map| to a dict of strings for reporting.

  Args:
    test_expectation_map: A data_types.TestExpectationMap.

  Returns:
    A string dictionary representation of |test_expectation_map| in the
    following format:
    {
      expectation_file: {
        test_name: {
          expectation_summary: {
            builder_name: {
              'Fully passed in the following': [
                step1,
              ],
              'Partially passed in the following': {
                step2: [
                  failure_link,
                ],
              },
              'Never passed in the following': [
                step3,
              ],
            }
          }
        }
      }
    }
  """ # This initially looks like a good target for using # data_types.TestExpectationMap's iterators since there are many nested loops. # However, we need to reset state in different loops, and the alternative of # keeping all the state outside the loop and resetting under certain # conditions ends up being less readable than just using nested loops.
A string dictionary representation of |test_expectation_map| in the
following format:
{
expectation_file: {
test_name: {
expectation_summary: {
builder_name: {
'Fully passed in the following': [
step1,
],
'Partially passed in the following': {
step2: [
failure_link,
],
},
'Never passed in the following': [
step3,
],
}
}
}
}
}
A string dictionary representation of |test_expectation_map| in the following format : { expectation_file : { test_name : { expectation_summary : { builder_name : { ' Fully passed in the following ' : [ step1 ] ' Partially passed in the following ' : { step2 : [ failure_link ] } ' Never passed in the following ' : [ step3 ] } } } } }
test_expectation_map
None