Ejemplo n.º 1
0
 def isPlayerTurn(self):
     """ Test that the condition is true, if the player is the current player """
     context = BuildPlayerContext()
     context.player = context.owner.player
     result = self.condition.evaluate(context)
     self.assertTrue(
         result,
         "The condition should return true, if the player is the current turn's player"
     )
Ejemplo n.º 2
0
 def isNotPlayerTurn(self):
     """ Test that the condition is false, if the player is not the current player """
     context = BuildPlayerContext()
     context.player = BuildPlayer()
     result = self.condition.evaluate(context)
     self.assertFalse(
         result,
         "The condition should return false, if the player is not the current turn's player"
     )
Ejemplo n.º 3
0
 def criteriaUsed(self):
     """ Test that the condition is false, if the criteria limits the matches below the required number """
     name = "Test Name"
     cards = [BuildCard(name=name) for i in range(10)]
     event = CardsEvent(cards, None, BuildPlayerContext())
     result = Matching(EVENT, criteria=FixedCriteria("name", name, "!=")).evaluate(event.context)
     self.assertFalse(result, "The Condition should be false, if the criteria limits the matching cards")
Ejemplo n.º 4
0
 def noCards(self):
     """ Test that if the source has no cards, the condition returns false """
     event = CardsEvent([], None, BuildPlayerContext())
     result = HasCards(EVENT).evaluate(event.context)
     self.assertFalse(
         result,
         "The Condition should be false, if the source has no cards")
Ejemplo n.º 5
0
 def emptyFilter(self):
     """ Test that if the filter returns no cards, the condition returns false """
     event = CardsEvent([], None, BuildPlayerContext())
     result = HasCards(EVENT, filter=DummyFilter()).evaluate(event.context)
     self.assertFalse(
         result,
         "The Condition should be false, if the filter returns no cards")
Ejemplo n.º 6
0
 def setUp(self):
     """ Build the Game, Context, and Effects for the test """
     self.game = BuildGame()
     self.context = BuildPlayerContext()
     self.effects = [DummyEffect() for i in range(10)]
     
     self.calledUnregisterActivatable = False
     self.context.owner.unregisterActivatable = self.unregisterActivatable
Ejemplo n.º 7
0
 def underfilled(self):
     """ Test that the condition returns false when the line up is underfilled """
     context = BuildPlayerContext()
     [context.game.lineUp.add(i) for i in range(LineUp.LINE_UP_SIZE - 1)]
     result = FullLineUp().evaluate(context)
     self.assertFalse(
         result,
         "The Condition should be false when the line up has too few elements"
     )
Ejemplo n.º 8
0
 def full(self):
     """ Test that the condition returns true when the line up is full """
     context = BuildPlayerContext()
     [context.game.lineUp.add(i) for i in range(LineUp.LINE_UP_SIZE)]
     result = FullLineUp().evaluate(context)
     self.assertTrue(
         result,
         "The Condition should be true when the line up has the proper number of elements"
     )
Ejemplo n.º 9
0
 def filterHasCards(self):
     """ Test that if the filter returns cards, the condition returns true """
     event = CardsEvent([1, 2, 3], None, BuildPlayerContext())
     result = HasCards(EVENT,
                       filter=DummyFilter(results=[1, 2, 3])).evaluate(
                           event.context)
     self.assertTrue(
         result,
         "The Condition should be true, if the filter returns cards")
Ejemplo n.º 10
0
 def setUp(self):
     """ Build the Filter for the test """
     self.cardName = "Blah Blah"
     self.cards = [BuildCard(name=self.cardName) for i in range(10)]
     cardsEvent = CardsEvent(self.cards, None, BuildPlayerContext())
     self.context = cardsEvent.context
Ejemplo n.º 11
0
 def setUp(self):
     """ Build the Event for the test """
     self.name = "Test Name"
     self.cardType = "A Type"
     self.event = CardsEvent([BuildCard(self.name, cardType=self.cardType)],
                             None, BuildPlayerContext())
Ejemplo n.º 12
0
 def notEnoughMatches(self):
     """ Test that the condition is false, if there are not enough matching cards """
     cards = [1,2,3]
     event = CardsEvent(cards, None, BuildPlayerContext())
     result = Matching(EVENT, number=len(cards)+1).evaluate(event.context)
     self.assertFalse(result, "The Condition should be false, if there are not enough matching cards")
Ejemplo n.º 13
0
 def matching(self):
     """ Test that the condition is true, if there are enough matching cards """
     event = CardsEvent([1], None, BuildPlayerContext())
     result = Matching(EVENT).evaluate(event.context)
     self.assertTrue(result, "The Condition should be true, if there are enough matching cards")
Ejemplo n.º 14
0
 def  setUp(self):
     """ Build the Zone and Criteria for the test """
     self.cardName = "Blah Blah"
     cardsEvent = CardsEvent([BuildCard(name=self.cardName)], None, BuildPlayerContext())
     self.context = cardsEvent.context
     self.criteria = ZoneCriteria("name", EVENT)
Ejemplo n.º 15
0
 def setUp(self):
     """ Build the Condition and Context for the test """
     self.neededPower = 4
     self.condition = EnoughPower(self.neededPower)
     self.context = BuildPlayerContext()
Ejemplo n.º 16
0
 def setUp(self):
     """ Build the Context for the test """
     self.name = "Test Name"
     self.event = CardsEvent([BuildCard(self.name)], None,
                             BuildPlayerContext())
Ejemplo n.º 17
0
 def isNotPlayerTurn(self):
     """ Test that the condition is false, if the player is not the current player """
     context = BuildPlayerContext()
     context.player = BuildPlayer()
     result = self.condition.evaluate(context)
     self.assertFalse(result, "The condition should return false, if the player is not the current turn's player")
Ejemplo n.º 18
0
 def isPlayerTurn(self):
     """ Test that the condition is true, if the player is the current player """
     context = BuildPlayerContext()
     context.player = context.owner.player
     result = self.condition.evaluate(context)
     self.assertTrue(result, "The condition should return true, if the player is the current turn's player")
Ejemplo n.º 19
0
 def setUp(self):
     """ Build the Event for the test """
     self.event = PlayedCardEvent(None, BuildPlayerContext())
     self.effect = DummyEffect()
     self.calledUnregisterTrigger = False
     self.event.context.owner.unregisterTrigger = self.unregisterTrigger
Ejemplo n.º 20
0
 def hasCards(self):
     """ Test that if the source has cards, the condition returns true """
     event = CardsEvent([1, 2, 3], None, BuildPlayerContext())
     result = HasCards(EVENT).evaluate(event.context)
     self.assertTrue(
         result, "The Condition should be true, if the source has cards")