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

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

Issue 914083005: [Telemetry] Fix 'important' field of certain Values being non-boolean (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Ned's comment Created 5 years, 10 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
Index: tools/telemetry/telemetry/value/value_unittest.py
diff --git a/tools/telemetry/telemetry/value/value_unittest.py b/tools/telemetry/telemetry/value/value_unittest.py
index 69e48d918c181b07f356c63a1445002fa18bab49..4ebd7064fe7b35270dd03739755a4f0fc42cca0f 100644
--- a/tools/telemetry/telemetry/value/value_unittest.py
+++ b/tools/telemetry/telemetry/value/value_unittest.py
@@ -91,6 +91,26 @@ class ValueTest(TestBase):
b = ValueForTest(page0, 'x', 'unit', important=True, description=None)
self.assertFalse(b.IsMergableWith(a))
+ def testPageMustBePageOrNone(self):
+ with self.assertRaises(AssertionError):
+ value.Value('foo', 'x', 'unit', important=False, description=None)
+
+ def testNameMustBeString(self):
+ with self.assertRaises(AssertionError):
+ value.Value(None, 42, 'unit', important=False, description=None)
+
+ def testUnitsMustBeString(self):
+ with self.assertRaises(AssertionError):
+ value.Value(None, 'x', 42, important=False, description=None)
+
+ def testImportantMustBeBool(self):
+ with self.assertRaises(AssertionError):
+ value.Value(None, 'x', 'unit', important='foo', description=None)
+
+ def testDescriptionMustBeStringOrNone(self):
+ with self.assertRaises(AssertionError):
+ value.Value(None, 'x', 'unit', important=False, description=42)
+
def testAsDictBaseKeys(self):
v = ValueForAsDictTest(None, 'x', 'unit', important=True, description=None)
d = v.AsDict()

Powered by Google App Engine
This is Rietveld 408576698