tools/metrics/histograms/extract_histograms_test.py
def testComponentExtraction(self):
    """Checks that components are successfully extracted from histograms."""
    histogram = xml.dom.minidom.parseString("""
<histogram-configuration>
<histograms>
  <histogram name="Coffee" expires_after="2022-01-01">
    <owner>histogram_owner@google.com</owner>
    <summary>An ode to coffee.</summary>
    <component>Liquid&gt;Hot</component>
    <component>Caffeine</component>
  </histogram>
</histograms>

<histogram_suffixes_list>
  <histogram_suffixes name="Brand" separator=".">
    <suffix name="Dunkies" label="The coffee is from Dunkin."/>
    <affected-histogram name="Coffee"/>
  </histogram_suffixes>
</histogram_suffixes_list>
</histogram-configuration>
""")
    histograms, _ = extract_histograms.ExtractHistogramsFromDom(histogram)
    self.assertEqual(histograms['Coffee']['components'],
                     ['Liquid>Hot', 'Caffeine'])
    self.assertEqual(histograms['Coffee.Dunkies']['components'],
                     ['Liquid>Hot', 'Caffeine'])
Checks that components are successfully extracted from histograms.
Checks that components are successfully extracted from histograms.
Checks that components are successfully extracted from histograms .
def testComponentExtraction(self):
    histogram = xml.dom.minidom.parseString("""
<histogram-configuration>
<histograms>
  <histogram name="Coffee" expires_after="2022-01-01">
    <owner>histogram_owner@google.com</owner>
    <summary>An ode to coffee.</summary>
    <component>Liquid&gt;Hot</component>
    <component>Caffeine</component>
  </histogram>
</histograms>
<histogram_suffixes_list>
  <histogram_suffixes name="Brand" separator=".">
    <suffix name="Dunkies" label="The coffee is from Dunkin."/>
    <affected-histogram name="Coffee"/>
  </histogram_suffixes>
</histogram_suffixes_list>
</histogram-configuration>
""")
    histograms, _ = extract_histograms.ExtractHistogramsFromDom(histogram)
    self.assertEqual(histograms['Coffee']['components'],
                     ['Liquid>Hot', 'Caffeine'])
    self.assertEqual(histograms['Coffee.Dunkies']['components'],
                     ['Liquid>Hot', 'Caffeine'])
def testComponentExtraction ( self ) : histogram = xml . dom . minidom . parseString ( """
<histogram-configuration>
<histograms>
  <histogram name="Coffee" expires_after="2022-01-01">
    <owner>histogram_owner@google.com</owner>
    <summary>An ode to coffee.</summary>
    <component>Liquid&gt;Hot</component>
    <component>Caffeine</component>
  </histogram>
</histograms>

<histogram_suffixes_list>
  <histogram_suffixes name="Brand" separator=".">
    <suffix name="Dunkies" label="The coffee is from Dunkin."/>
    <affected-histogram name="Coffee"/>
  </histogram_suffixes>
</histogram_suffixes_list>
</histogram-configuration>
""" ) histograms , _ = extract_histograms . ExtractHistogramsFromDom ( histogram ) self . assertEqual ( histograms [ 'Coffee' ] [ 'components' ] , [ 'Liquid>Hot' , 'Caffeine' ] ) self . assertEqual ( histograms [ 'Coffee.Dunkies' ] [ 'components' ] , [ 'Liquid>Hot' , 'Caffeine' ] )
Checks that components are successfully extracted from histograms.
Checks that components are successfully extracted from histograms .
"""Checks that components are successfully extracted from histograms."""
self