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" )
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" )
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")
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")
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")
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
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" )
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" )
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")
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
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())
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")
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")
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)
def setUp(self): """ Build the Condition and Context for the test """ self.neededPower = 4 self.condition = EnoughPower(self.neededPower) self.context = BuildPlayerContext()
def setUp(self): """ Build the Context for the test """ self.name = "Test Name" self.event = CardsEvent([BuildCard(self.name)], None, BuildPlayerContext())
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")
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")
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
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")