def __init__(self): self.book_stat = BookStat() self.book_quality = BookQuality() self.book_color = BookColor() self.book_dice = BookDice() self.colors = self.book_color.get_list() self.qualities = self.book_quality.get_list_of_qualities() self.stat_weights = self.book_quality.get_qualities() self.ids = [] self.max_rand_id = 10000000
def test_faction_receives_an_armor(self): colors = BookColor().get_list() armor_smith = SmithArmor() new_armor = armor_smith.create() self.sut.rack_armor.give_armor(new_armor) given_arm = self.sut.rack_armor.armors[new_armor.id] self.assertTrue(given_arm.color in colors)
def test_faction_receives_a_weapon(self): colors = BookColor().get_list() weapon_smith = SmithWeapon() new_weapon = weapon_smith.create() self.sut.rack_weapon.give_weapon(new_weapon) given_wpn = self.sut.rack_weapon.weapons[new_weapon.id] self.assertTrue(given_wpn.color in colors)
class Smith(object): def __init__(self): self.book_stat = BookStat() self.book_quality = BookQuality() self.book_color = BookColor() self.book_dice = BookDice() self.colors = self.book_color.get_list() self.qualities = self.book_quality.get_list_of_qualities() self.stat_weights = self.book_quality.get_qualities() self.ids = [] self.max_rand_id = 10000000 def set_seed(self, seed): random.seed(seed) def create(self): return 1 def generate_color(self, color='Any'): if color == 'Any': color = choice(self.colors) return color def generate_id(self): new_id = randint(1, self.max_rand_id) while new_id in self.ids: new_id = randint(1, self.max_rand_id) self.ids.append(new_id) return new_id def get_dice(self, color): return Dice( attack=self.book_dice.get_attack(color), defense=self.book_dice.get_defense(color), morale=self.book_dice.get_morale(color), )
def test_create_check_color(self): colors = BookColor().get_list() weapon = self.sut.create() self.assertTrue(weapon.color in colors)
def test_generate_color(self): book_color = BookColor() colors = book_color.get_list() self.assertTrue(self.sut.generate_color() in colors)
def test_create_check_color(self): colors = BookColor().get_list() armor = self.sut.create() self.assertTrue(armor.color in colors)