예제 #1
0
 def testUnsatisfiedDependency(self):
     items = []
     numIndependants = 3
     numUnsatisfied = 6
     indis = []
     for _i in range(0, numIndependants):
         indis.append((self.id.next()))  #1-3
     items.extend(indis)
     items.append((self.id.next(), [1, 2]))  #4
     items.append((self.id.next(), [1, 4]))  #5
     items.append((self.id.next(), [1, 3, 4]))  #6
     items.append((self.id.next(), [2, 8]))  #7
     unsat = []
     unsats = []
     for _i in range(0, numUnsatisfied):
         id_ = self.id.next()
         unsats.append(id_)
         unsat.append((id_, [1000 + _i]))
     items.extend(unsat)
     try:
         Checker.verify(items)
     except CircularDependencyException, e:
         assert False, "No circular dependencies expected:\r\n%(E)s\r\n%(T)s" % {
             "E": e,
             "T": traceback.format_exc()
         }
예제 #2
0
 def testSelfDependeny(self):
     items = []
     numIndependants = 3
     numUnsatisfied = 0
     indis = []
     for _i in range(0, numIndependants):
         indis.append((self.id.next()))  #1-3
     items.extend(indis)
     items.append((self.id.next(), [1, 2]))  #4
     items.append((self.id.next(), [1, 4]))  #5
     items.append((self.id.next(), [1, 3, 4]))  #6
     items.append((self.id.next(), [2, 8]))  #7
     #    Self dependency 'Offender':
     id_ = self.id.next()
     offender = id_
     items.append((id_, [6, 8]))  #8
     unsat = []
     unsats = []
     for _i in range(0, numUnsatisfied):
         id_ = self.id.next()
         unsats.append(id_)
         unsat.append((id_, [1000 + _i]))
     items.extend(unsat)
     try:
         Checker.verify(items)
     except SelfDependencyException, e:
         uId = e.uId()
         assert uId == offender, "Expecting Self offender: %(N)s." % {
             "N": offender
         }
예제 #3
0
 def testCircularDependeny(self):
     items = []
     numIndependants = 3
     numUnsatisfied = 0
     indis = []
     for _i in range(0, numIndependants):
         indis.append((self.id.next()))  #1-3
     items.extend(indis)
     items.append((self.id.next(), [1, 2]))  #4
     items.append((self.id.next(), [1, 4]))  #5
     items.append((self.id.next(), [1, 3, 4]))  #6
     offenders = []
     id_ = self.id.next()
     offenders.append(id_)
     items.append((id_, [2, 8]))  #7
     #    Circular dependency 'Offender':
     id_ = self.id.next()
     offenders.append(id_)
     items.append((id_, [6, 7]))  #8
     unsat = []
     unsats = []
     for _i in range(0, numUnsatisfied):
         id_ = self.id.next()
         unsats.append(id_)
         unsat.append((id_, [1000 + _i]))
     items.extend(unsat)
     try:
         Checker.verify(items)
     except CircularDependencyException, e:
         offender = e.getOffender()
         assert offender in offenders, "Expecting circular offender: %(N)s not in offenders list: %(E)s\r\n%(T)s" % {
             "N": offender,
             "E": offenders
         }
예제 #4
0
 def testComplex(self):
     items = []
     numIndependants = 1
     numUnsatisfied = 0
     indis = []
     for _i in range(0, numIndependants):
         indis.append((self.id.next()))  #1
     items.extend(indis)
     items.append((self.id.next(), [1]))  #2
     items.append((self.id.next(), [1]))  #3
     items.append((self.id.next(), [1, 2]))  #4
     items.append((self.id.next(), [2, 3]))  #5
     items.append((self.id.next(), [3]))  #6
     items.append((self.id.next(), [4, 5]))  #7
     items.append((self.id.next(), [4, 6]))  #8
     items.append((self.id.next(), [4, 5, 6]))  #9
     items.append((self.id.next(), [7, 8]))  #10
     items.append((self.id.next(), [10]))  #11
     items.append((self.id.next(), [2, 7, 10]))  #12
     endId = self.id.next()
     items.append((endId, [1, 2, 4, 9, 10, 11, 12]))  #13
     eMaxDepth = 7
     unsat = []
     unsats = []
     for _i in range(0, numUnsatisfied):
         id_ = self.id.next()
         unsats.append(id_)
         unsat.append((id_, [1000 + _i]))
     items.extend(unsat)
     try:
         dc = Checker.verify(items)
     except Exception, _e:
         raise
예제 #5
0
 def testNoRoot(self):
     items = []
     numIndependants = 0
     numUnsatisfied = 0
     indis = []
     for _i in range(0, numIndependants):
         indis.append((self.id.next()))  #0 INVALID
     items.extend(indis)
     items.append((self.id.next(), [1, 2]))  #1
     items.append((self.id.next(), [1]))  #2
     unsat = []
     unsats = []
     for _i in range(0, numUnsatisfied):
         id_ = self.id.next()
         unsats.append(id_)
         unsat.append((id_, [1000 + _i]))
     items.extend(unsat)
     try:
         Checker.verify(items)
     except NoRootException, _e:
         assert True, "Correctly raised exception!"
예제 #6
0
 def testHappyPath(self):
     items = []
     numIndependants = 3
     numUnsatisfied = 0
     indis = []
     for _i in range(0, numIndependants):
         indis.append((self.id.next()))  #1-3
     items.extend(indis)
     items.append((self.id.next(), [1, 2]))  #4
     items.append((self.id.next(), [1, 4]))  #5
     items.append((self.id.next(), [1, 3, 4]))  #6
     eMaxDepth = 3
     unsat = []
     unsats = []
     for _i in range(0, numUnsatisfied):
         id_ = self.id.next()
         unsats.append(id_)
         unsat.append((id_, [1000 + _i]))
     items.extend(unsat)
     try:
         dc = Checker.verify(items)
     except Exception, _e:
         raise