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

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

Issue 417193005: Add Value FromDict to Telemetry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Nat's comments Created 6 years, 4 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/string.py ('k') | tools/telemetry/telemetry/value/value_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/value/string_unittest.py
diff --git a/tools/telemetry/telemetry/value/string_unittest.py b/tools/telemetry/telemetry/value/string_unittest.py
index 5728b4f8b03ff79643b4f4bcb5ee7f3b3312e35a..b8cc2a386e532ca9ae696ef933dd54910da3818f 100644
--- a/tools/telemetry/telemetry/value/string_unittest.py
+++ b/tools/telemetry/telemetry/value/string_unittest.py
@@ -60,10 +60,23 @@ class StringValueTest(TestBase):
self.assertEquals(True, vM.important)
self.assertEquals(['L1', 'L2'], vM.values)
- def testAsDictIsAccurate(self):
+ def testAsDict(self):
v = string.StringValue(None, 'x', 'unit', 'foo', important=False)
d = v.AsDictWithoutBaseClassEntries()
self.assertEquals(d, {
'value': 'foo'
})
+
+ def testFromDict(self):
+ d = {
+ 'type': 'string',
+ 'name': 'x',
+ 'units': 'unit',
+ 'value': 'foo'
+ }
+
+ v = value.Value.FromDict(d, {})
+
+ self.assertTrue(isinstance(v, string.StringValue))
+ self.assertEquals(v.value, 'foo')
« no previous file with comments | « tools/telemetry/telemetry/value/string.py ('k') | tools/telemetry/telemetry/value/value_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698