Next / Previous / Contents / Shipman's homepage

19. Truths._overcovered(): Message for an over-covered input set

# - - -   T r u t h s . _ o v e r c o v e r e d

    def _overcovered(self, inputList, matchList):
        '''Format the message for over-covered inputs.

          [ (inputList is a list of (self._caseCount) bool values) and
            (matchList is a nonempty list of numbers in the interval
            [0, self._caseCount)) ->
              return a "covers N cases" message showing inputList
              and the cases whose indices are in matchList ]

First we build the string of all the cases in matchList. Each case is a vertical slice of self._condList whose index is given by an element of matchList. See Section 20, “Truths._oneCase(): Display the codes for one case” for the logic that extracts the codes for one case.

        #-- 1
        # [ caseDisplay  :=  list of all the cases in self whose
        #       indices are in matchList, with each case represented
        #       by the codes in TRUTH_CODES, and spaces between the
        #       cases ]
        caseDisplay = ' '.join([self._oneCase(casex)
                                for casex in matchList])

        #-- 2
        return ("{inputs}: covers {n} cases: {cases}".format(
            inputs=self._showInputs(inputList), n=len(matchList),