コード例 #1
0
 def  setUp(self):
     """ Build the Cost Calculator for the test """
     self.modifierCosts = [1, 2, 3, 4, 5]
     self.cost = 10
     self.costCalculator = FixedCost(self.cost)
     
     self.costCalculatorWithCostMods = FixedCost(self.cost)
     [self.costCalculatorWithCostMods.addCostModifier(FixedCost(cost)) for cost in self.modifierCosts]
コード例 #2
0
class addCostModifier(unittest.TestCase):
    """ Test cases of addCostModifier """
    
    def  setUp(self):
        """ Build the Cost Calculator and Modifier for the test """
        self.cost = 10
        self.costCalculator = FixedCost(self.cost)
        
    def added(self):
        """ Test that the Cost Modifier is added """
        costMod = FixedCost(1)
        self.costCalculator.addCostModifier(costMod)
        self.assertIn(costMod, self.costCalculator.costModifiers, "The Cost Mod should be added to the Cost Mods of the Fixed Cost Calculator")
コード例 #3
0
def BuildCard(name="Test", cardType=None, **kwargs):
    """ Build a Card for testing purposes """
    return Card(name,
                cardType,
                costCalculator=FixedCost(1),
                vpCalculator=FixedPoints(1),
                **kwargs)
コード例 #4
0
class calculateCost(unittest.TestCase):
    """ Test cases of calculateCost """
    
    def  setUp(self):
        """ Build the Cost Calculator for the test """
        self.modifierCosts = [1, 2, 3, 4, 5]
        self.cost = 10
        self.costCalculator = FixedCost(self.cost)
        
        self.costCalculatorWithCostMods = FixedCost(self.cost)
        [self.costCalculatorWithCostMods.addCostModifier(FixedCost(cost)) for cost in self.modifierCosts]
        
        
    def basicCost(self):
        """ Test that the basic cost is returned proeprly """
        cost = self.costCalculator.calculateCost()
        self.assertEquals(cost, self.cost, "The Cost should be the cost of the Fixed Cost Calculator")
        
    def withCostMods(self):
        """ Test that the cost is returned proeprly with cost mods """
        cost = self.costCalculatorWithCostMods.calculateCost()
        self.assertEquals(cost, sum([self.cost] + self.modifierCosts), "The Cost should be the cost of the Fixed Cost Calculator and all of its Cost Mods")
コード例 #5
0
class removeCostModifier(unittest.TestCase):
    """ Test cases of removeCostModifier """
    
    def  setUp(self):
        """ Build the *** for the test """
        self.cost = 10
        self.costCalculator = FixedCost(self.cost)
        self.costMod = FixedCost(1)
        self.costCalculator.addCostModifier(self.costMod)
        
    def removed(self):
        """ Test that the Cost Mod is properly removed when it is added """
        self.costCalculator.removeCostModifier(self.costMod)
        self.assertNotIn(self.costMod, self.costCalculator.costModifiers, "The Cost Mod should be remvoed from the Cost Mods of the Fixed Cost Calculator")
        
    def notInCostMods(self):
        """ Test that no error is thrown when attempting to remove a Cost Mod that has not been added """
        costMod = FixedCost(1)
        self.costCalculator.removeCostModifier(costMod)
コード例 #6
0
 def notInCostMods(self):
     """ Test that no error is thrown when attempting to remove a Cost Mod that has not been added """
     costMod = FixedCost(1)
     self.costCalculator.removeCostModifier(costMod)
コード例 #7
0
 def  setUp(self):
     """ Build the *** for the test """
     self.cost = 10
     self.costCalculator = FixedCost(self.cost)
     self.costMod = FixedCost(1)
     self.costCalculator.addCostModifier(self.costMod)
コード例 #8
0
 def added(self):
     """ Test that the Cost Modifier is added """
     costMod = FixedCost(1)
     self.costCalculator.addCostModifier(costMod)
     self.assertIn(costMod, self.costCalculator.costModifiers, "The Cost Mod should be added to the Cost Mods of the Fixed Cost Calculator")
コード例 #9
0
 def  setUp(self):
     """ Build the Cost Calculator and Modifier for the test """
     self.cost = 10
     self.costCalculator = FixedCost(self.cost)
コード例 #10
0
ファイル: card_factory.py プロジェクト: fozware/DeckBuilding
def loadCost(data):
    """ Load the Cost """
    return FixedCost(data["cost"])