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

Unified Diff: dashboard/dashboard/add_point_test.py

Issue 1935593002: Also accept long values in lists of scalar values. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Created 4 years, 8 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 | « dashboard/dashboard/add_point.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/add_point_test.py
diff --git a/dashboard/dashboard/add_point_test.py b/dashboard/dashboard/add_point_test.py
index a5c16307f710e7aa46214ca6aeb6d80b9f4366ac..cbaa5c2efcf6569bcfa1f1e7b231ae43cec65e47 100644
--- a/dashboard/dashboard/add_point_test.py
+++ b/dashboard/dashboard/add_point_test.py
@@ -1205,6 +1205,14 @@ class FlattenTraceTest(testing_common.TestCase):
self.assertTrue(math.isnan(row['value']))
self.assertEqual(row['error'], 0)
+ def testFlattenTrace_ScalarLongValue(self):
+ """Tests that scalar values can be longs."""
+ trace = self._SampleTrace()
+ trace.update({'value': 1000000000L})
+ row = add_point._FlattenTrace('foo', 'bar', 'baz', trace)
+ self.assertEqual(row['value'], 1000000000L)
+ self.assertEqual(row['error'], 0)
+
def testFlattenTrace_InvalidScalarValue_RaisesError(self):
"""Tests that scalar NoneValue is flattened to NaN."""
trace = self._SampleTrace()
@@ -1223,6 +1231,17 @@ class FlattenTraceTest(testing_common.TestCase):
self.assertAlmostEqual(row['value'], 13)
self.assertAlmostEqual(row['error'], 6.78232998)
+ def testFlattenTrace_ListValue_WithLongs(self):
+ """Tests that lists of scalars can include longs."""
+ trace = self._SampleTrace()
+ trace.update({
+ 'type': 'list_of_scalar_values',
+ 'values': [1000000000L, 2000000000L],
+ })
+ row = add_point._FlattenTrace('foo', 'bar', 'baz', trace)
+ self.assertAlmostEqual(row['value'], 1500000000L)
+ self.assertAlmostEqual(row['error'], 500000000L)
+
def testFlattenTrace_ListValueWithStd(self):
"""Tests that lists with reported std use std as error."""
trace = self._SampleTrace()
« no previous file with comments | « dashboard/dashboard/add_point.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698