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]
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")
def BuildCard(name="Test", cardType=None, **kwargs): """ Build a Card for testing purposes """ return Card(name, cardType, costCalculator=FixedCost(1), vpCalculator=FixedPoints(1), **kwargs)
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")
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)
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)
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 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")
def setUp(self): """ Build the Cost Calculator and Modifier for the test """ self.cost = 10 self.costCalculator = FixedCost(self.cost)
def loadCost(data): """ Load the Cost """ return FixedCost(data["cost"])