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

Unified Diff: telemetry/telemetry/internal/results/valueset_output_formatter_unittest.py

Issue 2556213002: Revert of Replace ValueSetOutputFormatter with HistogramSetJsonOutputFormatter. (Closed)
Patch Set: Created 4 years 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 | « telemetry/telemetry/internal/results/valueset_output_formatter.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/internal/results/valueset_output_formatter_unittest.py
diff --git a/telemetry/telemetry/internal/results/valueset_output_formatter_unittest.py b/telemetry/telemetry/internal/results/valueset_output_formatter_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..3dd83a2fa2cf241d7ad3a3e20677afaefa9594ef
--- /dev/null
+++ b/telemetry/telemetry/internal/results/valueset_output_formatter_unittest.py
@@ -0,0 +1,48 @@
+# Copyright 2014 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 json
+import os
+import tempfile
+import unittest
+
+from telemetry.internal.results import valueset_output_formatter
+from telemetry.internal.results import page_test_results
+
+
+class ValueSetOutputFormatterTest(unittest.TestCase):
+
+ def setUp(self):
+ self.output_file_path = tempfile.mkstemp()[1]
+
+ def tearDown(self):
+ try:
+ os.remove(self.output_file_path)
+ except OSError:
+ pass
+
+ def test_basic_summary(self):
+ sample = {
+ 'name': 'a',
+ 'guid': '42',
+ 'description': 'desc',
+ 'important': False,
+ 'diagnostics': [],
+ 'type': 'numeric',
+ 'numeric': {
+ 'unit': 'n%',
+ 'type': 'scalar',
+ 'value': 42
+ }
+ }
+
+ results = page_test_results.PageTestResults()
+ results.value_set.extend([sample])
+
+ with open(self.output_file_path, 'w') as output_file:
+ formatter = valueset_output_formatter.ValueSetOutputFormatter(output_file)
+ formatter.Format(results)
+
+ written_data = json.load(open(self.output_file_path))
+ self.assertEqual([sample], written_data)
+
« no previous file with comments | « telemetry/telemetry/internal/results/valueset_output_formatter.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698