Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: tools/telemetry/telemetry/value/histogram_unittest.py

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/telemetry/telemetry/value/histogram.py ('k') | tools/telemetry/telemetry/value/histogram_util.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/value/histogram_unittest.py
diff --git a/tools/telemetry/telemetry/value/histogram_unittest.py b/tools/telemetry/telemetry/value/histogram_unittest.py
deleted file mode 100644
index 8cf75e445a267de51e1d3a00bf965bb2d88ab9da..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/value/histogram_unittest.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-import os
-import unittest
-
-from telemetry import story
-from telemetry import page as page_module
-from telemetry import value
-from telemetry.value import histogram as histogram_module
-from telemetry.value import improvement_direction
-
-
-class TestBase(unittest.TestCase):
- def setUp(self):
- story_set = story.StorySet(base_dir=os.path.dirname(__file__))
- story_set.AddStory(
- page_module.Page("http://www.bar.com/", story_set, story_set.base_dir))
- story_set.AddStory(
- page_module.Page("http://www.baz.com/", story_set, story_set.base_dir))
- story_set.AddStory(
- page_module.Page("http://www.foo.com/", story_set, story_set.base_dir))
- self.story_set = story_set
-
- @property
- def pages(self):
- return self.story_set.stories
-
-class ValueTest(TestBase):
- def testRepr(self):
- page = self.pages[0]
- v = histogram_module.HistogramValue(
- page, 'x', 'counts',
- raw_value_json='{"buckets": [{"low": 1, "high": 2, "count": 1}]}',
- important=True, description='desc', tir_label='my_ir',
- improvement_direction=improvement_direction.UP)
- expected = ('HistogramValue(http://www.bar.com/, x, counts, '
- 'raw_json_string={"buckets": [{"low": 1, "high": 2, "count": '
- '1}]}, important=True, description=desc, tir_label=my_ir, '
- 'improvement_direction=up)')
-
- self.assertEquals(expected, str(v))
-
- def testHistogramBasic(self):
- page0 = self.pages[0]
- histogram = histogram_module.HistogramValue(
- page0, 'x', 'counts',
- raw_value_json='{"buckets": [{"low": 1, "high": 2, "count": 1}]}',
- important=False, improvement_direction=improvement_direction.UP)
- self.assertEquals(
- ['{"buckets": [{"low": 1, "high": 2, "count": 1}]}'],
- histogram.GetBuildbotValue())
- self.assertEquals(1.5,
- histogram.GetRepresentativeNumber())
- self.assertEquals(
- ['{"buckets": [{"low": 1, "high": 2, "count": 1}]}'],
- histogram.GetBuildbotValue())
-
- self.assertEquals(
- 'unimportant-histogram',
- histogram.GetBuildbotDataType(value.SUMMARY_RESULT_OUTPUT_CONTEXT))
- histogram.important = True
- self.assertEquals(
- 'histogram',
- histogram.GetBuildbotDataType(value.SUMMARY_RESULT_OUTPUT_CONTEXT))
-
- def testBucketAsDict(self):
- bucket = histogram_module.HistogramValueBucket(33, 45, 78)
- d = bucket.AsDict()
-
- self.assertEquals(d, {
- 'low': 33,
- 'high': 45,
- 'count': 78
- })
-
- def testAsDict(self):
- histogram = histogram_module.HistogramValue(
- None, 'x', 'counts',
- raw_value_json='{"buckets": [{"low": 1, "high": 2, "count": 1}]}',
- important=False, improvement_direction=improvement_direction.DOWN)
- d = histogram.AsDictWithoutBaseClassEntries()
-
- self.assertEquals(['buckets'], d.keys())
- self.assertTrue(isinstance(d['buckets'], list))
- self.assertEquals(len(d['buckets']), 1)
-
- def testFromDict(self):
- d = {
- 'type': 'histogram',
- 'name': 'x',
- 'units': 'counts',
- 'buckets': [{'low': 1, 'high': 2, 'count': 1}],
- 'improvement_direction': 'down',
- }
- v = value.Value.FromDict(d, {})
-
- self.assertTrue(isinstance(v, histogram_module.HistogramValue))
- self.assertEquals(
- ['{"buckets": [{"low": 1, "high": 2, "count": 1}]}'],
- v.GetBuildbotValue())
- self.assertEquals(improvement_direction.DOWN, v.improvement_direction)
-
- def testFromDictWithoutImprovementDirection(self):
- d = {
- 'type': 'histogram',
- 'name': 'x',
- 'units': 'counts',
- 'buckets': [{'low': 1, 'high': 2, 'count': 1}],
- }
- v = value.Value.FromDict(d, {})
-
- self.assertTrue(isinstance(v, histogram_module.HistogramValue))
- self.assertIsNone(v.improvement_direction)
« no previous file with comments | « tools/telemetry/telemetry/value/histogram.py ('k') | tools/telemetry/telemetry/value/histogram_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698