示例#1
0
 def test_pick_widest(self):
     choices = [deciders.Depth.ATOM, deciders.Depth.FLOW]
     self.assertEqual(deciders.Depth.FLOW, deciders.pick_widest(choices))
     choices = [deciders.Depth.ATOM, deciders.Depth.FLOW,
                deciders.Depth.ALL]
     self.assertEqual(deciders.Depth.ALL, deciders.pick_widest(choices))
     choices = [deciders.Depth.ATOM, deciders.Depth.FLOW,
                deciders.Depth.ALL, deciders.Depth.NEIGHBORS]
     self.assertEqual(deciders.Depth.ALL, deciders.pick_widest(choices))
     choices = [deciders.Depth.ATOM, deciders.Depth.NEIGHBORS]
     self.assertEqual(deciders.Depth.NEIGHBORS,
                      deciders.pick_widest(choices))
示例#2
0
 def test_pick_widest(self):
     choices = [deciders.Depth.ATOM, deciders.Depth.FLOW]
     self.assertEqual(deciders.Depth.FLOW, deciders.pick_widest(choices))
     choices = [
         deciders.Depth.ATOM, deciders.Depth.FLOW, deciders.Depth.ALL
     ]
     self.assertEqual(deciders.Depth.ALL, deciders.pick_widest(choices))
     choices = [
         deciders.Depth.ATOM, deciders.Depth.FLOW, deciders.Depth.ALL,
         deciders.Depth.NEIGHBORS
     ]
     self.assertEqual(deciders.Depth.ALL, deciders.pick_widest(choices))
     choices = [deciders.Depth.ATOM, deciders.Depth.NEIGHBORS]
     self.assertEqual(deciders.Depth.NEIGHBORS,
                      deciders.pick_widest(choices))
示例#3
0
 def affect(self, runtime, nay_voters):
     # If there were many 'nay' edge deciders that were targeted
     # at this atom, then we need to pick the one which has the widest
     # impact and respect that one as the decider depth that will
     # actually affect things.
     widest_depth = deciders.pick_widest(ed.depth for ed in nay_voters)
     affector = self._depth_strategies[widest_depth]
     return affector(self._atom, runtime)