Example #1
0
class completable(unittest.TestCase):
    """ Test cases of completable """
    
    def  setUp(self):
        """ Build the Phase for the test """
        self.match1 = NumberSet(1)
        self.match2 = NumberSet(1)
        self.phase = Phase([self.match1, self.match2])
    
    def noMatches(self):
        """ Test that the phase is not completable when no matches are provided """
        assert not self.phase.completable({self.match1:[]}), "Phase should not be completable if all matches are not included"
    
    def notEnoughMatches(self):
        """ Test that the phase is not completable when not all matches are accounted for """
        assert not self.phase.completable({self.match1:[]}), "Phase should not be completable if all matches are not included"
        
    def unmatchedMatches(self):
        """ Test that the phase is not completable when neither match is finished """
        assert not self.phase.completable({self.match1:[], self.match2:[]}), "Phase should not be completable if all matches are not matched"
        
    def notAllMatchesMatched(self):
        """ Test that the phase is not completable when not all matches are finished """
        assert not self.phase.completable({self.match1:[], self.match2:[NumberCard(1, None)]}), "Phase should not be completable if all matches are not matched"
        
    def allMatchesMatched(self):
        """ Test that the phase is not completable when not all matches are finished """
        assert self.phase.completable({self.match1:[NumberCard(2, None)], self.match2:[NumberCard(1, None)]}), "Phase should be completable if all matches are matched"
Example #2
0
 def setUp(self):
     """ Build the Player and Phase List for the test """
     self.match1 = NumberSet(1)
     self.match2 = NumberSet(1)
     self.phase1 = Phase([self.match1, self.match2])
     self.phase2 = Phase([])
     self.phaseList = PhaseList([self.phase1, self.phase2])
     self.player = Player("", self.phaseList)
 def setUp(self):
     """ Build the Player Round Wrapper for the test """
     self.match1 = NumberSet(1)
     self.match2 = NumberSet(1)
     self.phase1 = Phase([self.match1, self.match2])
     self.phase2 = Phase([])
     self.phaseList = PhaseList([self.phase1, self.phase2])
     self.player = Player("", self.phaseList)
     self.matchPileManager = MatchPileManager()
     self.hand = [NumberCard(1, None), NumberCard(2, None)]
     self.playerRoundWrapper = PlayerRoundWrapper(self.player, self.hand,
                                                  self.matchPileManager)
Example #4
0
 def buildPhases(self):
     """ Builds and returns the standard phases in a list """
     phases = []
     phases.append(Phase([NumberSet(3), NumberSet(3)]))
     phases.append(Phase([NumberSet(3), Run(4)]))
     phases.append(Phase([NumberSet(4), Run(4)]))
     phases.append(Phase([Run(7)]))
     phases.append(Phase([Run(8)]))
     phases.append(Phase([Run(9)]))
     phases.append(Phase([NumberSet(4), NumberSet(4)]))
     phases.append(Phase([ColoredSet(7)]))
     phases.append(Phase([NumberSet(5), NumberSet(2)]))
     phases.append(Phase([NumberSet(5), NumberSet(3)]))
     return phases
Example #5
0
class completable(unittest.TestCase):
    """ Test cases of completable """
    def setUp(self):
        """ Build the Phase for the test """
        self.match1 = NumberSet(1)
        self.match2 = NumberSet(1)
        self.phase = Phase([self.match1, self.match2])

    def noMatches(self):
        """ Test that the phase is not completable when no matches are provided """
        assert not self.phase.completable({
            self.match1: []
        }), "Phase should not be completable if all matches are not included"

    def notEnoughMatches(self):
        """ Test that the phase is not completable when not all matches are accounted for """
        assert not self.phase.completable({
            self.match1: []
        }), "Phase should not be completable if all matches are not included"

    def unmatchedMatches(self):
        """ Test that the phase is not completable when neither match is finished """
        assert not self.phase.completable({
            self.match1: [],
            self.match2: []
        }), "Phase should not be completable if all matches are not matched"

    def notAllMatchesMatched(self):
        """ Test that the phase is not completable when not all matches are finished """
        assert not self.phase.completable({
            self.match1: [],
            self.match2: [NumberCard(1, None)]
        }), "Phase should not be completable if all matches are not matched"

    def allMatchesMatched(self):
        """ Test that the phase is not completable when not all matches are finished """
        assert self.phase.completable({
            self.match1: [NumberCard(2, None)],
            self.match2: [NumberCard(1, None)]
        }), "Phase should be completable if all matches are matched"
Example #6
0
 def  setUp(self):
     """ Build the Phase for the test """
     self.match1 = NumberSet(1)
     self.match2 = NumberSet(1)
     self.phase = Phase([self.match1, self.match2])
Example #7
0
 def setUp(self):
     """ Build the Phases and Phase List for the test """
     self.phase1 = Phase([])
     self.phase2 = Phase([])
     self.phaseList = PhaseList([self.phase1, self.phase2])
Example #8
0
 def setUp(self):
     """ Build the Phase for the test """
     self.match1 = NumberSet(1)
     self.match2 = NumberSet(1)
     self.phase = Phase([self.match1, self.match2])