def testDominance(self): # Check forward and backward label dominance L1 = Label(10, 'B', array([6, 5]), []) L2 = Label(1, 'B', array([6, -3]), []) L3 = Label(-10, 'A', array([3, -8]), []) L4 = Label(-10, 'A', array([4, -6]), []) self.assertTrue(L2.dominates(L1, "forward")) self.assertTrue(L3.dominates(L4, "forward"))
def testDominance(self): # Check forward and backward label dominance L1 = Label(0, 1, array([1, 1]), []) L2 = Label(-1, 1, array([1, 1]), []) L3 = Label(-10, 2, array([1, 1]), []) L4 = Label(-10, 2, array([0, 1]), []) L5 = Label(0, 2, array([1, 1]), []) self.assertTrue(L2.dominates(L1, "forward")) self.assertRaises(Exception, L1.dominates, L3) self.assertFalse(L3.dominates(L4, "forward")) self.assertTrue(L4.dominates(L3, "forward")) self.assertTrue(L3.dominates(L5, "forward"))
def test_dominance(self): # Check forward and backward label dominance L1 = Label(-10, "Sink", array([3, 0]), []) L2 = Label(0, "Sink", array([1, 0]), []) self.assertFalse(L1.dominates(L2, "forward")) self.assertFalse(L2.dominates(L1, "forward")) self.assertTrue(L1.dominates(L2, "backward")) self.assertFalse(L2.dominates(L1, "backward")) if not (L1.dominates(L2, "forward") or L2.dominates(L1, "forward")): self.assertTrue(L1.dominates(L2, "backward"))