示例#1
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)
示例#3
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
示例#4
0
class matched(unittest.TestCase):
    """ Test cases of matched """
    
    def  setUp(self):
        """ Build the Number Set for the test """
        self.numberSet = NumberSet(3)
        
    def noCards(self):
        """ Test that no cards returns False """
        assert not self.numberSet.matched([]), "Assert there is no match when no cards are given."
    
    def notEnoughCards(self):
        """ Test that no cards returns False """
        assert not self.numberSet.matched([self.getNumberCard()]), "Assert there is no match when not enough cards are given."
        
    def differentNumberCards(self):
        """ Test that no cards returns False """
        assert not self.numberSet.matched([self.getNumberCard(), self.getNumberCard(), self.getNumberCard(2)]), "Assert there is no match when there are enough cards, but of different numbers."
        
    def match(self):
        """ Test that no cards returns False """
        assert self.numberSet.matched([self.getNumberCard(), self.getNumberCard(), self.getNumberCard()]), "Assert there is a match when there are enough cards of the same number."
        
    def moreThanEnoughCards(self):
        """ Test that more than enough cards returns True """
        assert self.numberSet.matched([self.getNumberCard(), self.getNumberCard(), self.getNumberCard(), self.getNumberCard()]), "Assert there is a match when more than enough cards are given."
        
    def handleWildCard(self):
        """ Test that a wild card can complete the match """
        assert self.numberSet.matched([self.getNumberCard(), self.getNumberCard(), WildCard()]), "Assert there is a match when a wild is used."
        
    def getNumberCard(self, number=1):
        """ Returns a Number Card """
        return NumberCard(number, None)
示例#5
0
class matched(unittest.TestCase):
    """ Test cases of matched """
    def setUp(self):
        """ Build the Number Set for the test """
        self.numberSet = NumberSet(3)

    def noCards(self):
        """ Test that no cards returns False """
        assert not self.numberSet.matched(
            []), "Assert there is no match when no cards are given."

    def notEnoughCards(self):
        """ Test that no cards returns False """
        assert not self.numberSet.matched([
            self.getNumberCard()
        ]), "Assert there is no match when not enough cards are given."

    def differentNumberCards(self):
        """ Test that no cards returns False """
        assert not self.numberSet.matched(
            [
                self.getNumberCard(),
                self.getNumberCard(),
                self.getNumberCard(2)
            ]
        ), "Assert there is no match when there are enough cards, but of different numbers."

    def match(self):
        """ Test that no cards returns False """
        assert self.numberSet.matched(
            [self.getNumberCard(),
             self.getNumberCard(),
             self.getNumberCard()]
        ), "Assert there is a match when there are enough cards of the same number."

    def moreThanEnoughCards(self):
        """ Test that more than enough cards returns True """
        assert self.numberSet.matched([
            self.getNumberCard(),
            self.getNumberCard(),
            self.getNumberCard(),
            self.getNumberCard()
        ]), "Assert there is a match when more than enough cards are given."

    def handleWildCard(self):
        """ Test that a wild card can complete the match """
        assert self.numberSet.matched(
            [self.getNumberCard(),
             self.getNumberCard(),
             WildCard()]), "Assert there is a match when a wild is used."

    def getNumberCard(self, number=1):
        """ Returns a Number Card """
        return NumberCard(number, None)
示例#6
0
 def setUp(self):
     """ Build the Number Set for the test """
     self.numberSet = NumberSet(3)
示例#7
0
 def  setUp(self):
     """ Build the Number Set for the test """
     self.numberSet = NumberSet(3)
示例#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])