def testObjects(self):
     deserializer = histogram_deserializer.HistogramDeserializer(
         ['a', ['b']], {})
     self.assertEqual('a', deserializer.GetObject(0))
     self.assertEqual(['b'], deserializer.GetObject(1))
     with self.assertRaises(IndexError):
         deserializer.GetObject(2)
Esempio n. 2
0
 def testDeserialize(self):
     d = histogram_deserializer.HistogramDeserializer(
         ['a', 'b', 'c', [0, 1, 2], 'd', 'e', 'f'])
     names = related_name_map.RelatedNameMap.Deserialize([3, 4, 5, 6], d)
     self.assertEqual(names.Get('a'), 'd')
     self.assertEqual(names.Get('b'), 'e')
     self.assertEqual(names.Get('c'), 'f')
Esempio n. 3
0
 def testDeserialize(self):
     d = histogram_deserializer.HistogramDeserializer(
         ['a', 'b', 'c', [0, 1, 2], 'colors'])
     b = breakdown.Breakdown.Deserialize([4, 3, 1, 2, 3], d)
     self.assertEqual(b.color_scheme, 'colors')
     self.assertEqual(b.Get('a'), 1)
     self.assertEqual(b.Get('b'), 2)
     self.assertEqual(b.Get('c'), 3)
Esempio n. 4
0
 def testDeserialize(self):
   d = histogram_deserializer.HistogramDeserializer(['aaa', 'bbb'])
   a = generic_set.GenericSet.Deserialize(0, d)
   self.assertEqual(len(a), 1)
   self.assertIn('aaa', a)
   b = generic_set.GenericSet.Deserialize([0, 1], d)
   self.assertEqual(len(b), 2)
   self.assertIn('aaa', b)
   self.assertIn('bbb', b)
Esempio n. 5
0
 def testDeserialize(self):
     d = histogram_deserializer.HistogramDeserializer(['aaa'])
     events = related_event_set.RelatedEventSet.Deserialize(
         [[42, 0, 10, 20]], d)
     self.assertEqual(len(events), 1)
     event = list(events)[0]
     self.assertEqual(event['stableId'], 42)
     self.assertEqual(event['title'], 'aaa')
     self.assertEqual(event['start'], 10)
     self.assertEqual(event['duration'], 20)