Ejemplo n.º 1
0
 def test_normalized_subset(self):
     """ Tests `normalized` for a subset of keys. """
     # start and end are equally weighted:
     timing = Timing({0: 1, 1: 1})
     result = timing.normalized(keys={1})
     # Normalizing just end should yield a value of 1 at that time:
     target = Timing({1: 1})
     self.assertEqual(result, target)
Ejemplo n.º 2
0
 def test_normalized_basic(self):
     """ Tests `normalized` with simple input. """
     # start and end are equally weighted:
     timing = Timing({0: 1, 1: 1})
     result = timing.normalized()
     # start and end are equally weighted, so each should get 0.5
     # when normalized:
     target = Timing({0: 0.5, 1: 0.5})
     self.assertEqual(result, target)