def test_new_hand(self): # get new hand cards player1 = { 'name': 'player one', 'health': 30, 'deck': 2 * [deck_building_card.Card('Baker', (3, 0), 2)], 'hand': [deck_building_card.Card('Archer', (3, 0), 2)], 'active': [], 'handsize': 2, 'discard': [] } deck_building_card.act_end(player1) self.assertEqual(2, len(player1['hand']))
def test_empty_active(self): # remove all the cards in active area player1 = { 'name': 'player one', 'health': 30, 'deck': 10 * [deck_building_card.Card('Archer', (3, 0), 2)], 'hand': [], 'active': [deck_building_card.Card('Archer', (3, 0), 2)], 'handsize': 5, 'discard': [] } deck_building_card.act_end(player1) self.assertEqual([], player1['active'])
def test_hand(self): # test the hand is empty money = 0 attack = 0 player1 = { 'name': 'player one', 'health': 30, 'deck': [], 'hand': [deck_building_card.Card('Archer', (3, 0), 2)], 'active': [], 'handsize': 5, 'discard': [] } deck_building_card.act_play_all(money, attack, player1) self.assertEqual([], player1['hand'])
def test_player_get_value(self): # test the change of money and attack values money = 0 attack = 0 player1 = { 'name': 'player one', 'health': 30, 'deck': [], 'hand': [deck_building_card.Card('Archer', (3, 0), 2)], 'active': [], 'handsize': 5, 'discard': [] } money, attack = deck_building_card.\ act_play_all(money, attack, player1) self.assertEqual((3, 0), (attack, money))
def test_correct_input(self): act = 1 money = 0 attack = 0 player1 = { 'name': 'player one', 'health': 30, 'deck': [], 'hand': [deck_building_card.Card('Archer', (3, 0), 2)], 'active': [], 'handsize': 5, 'discard': [] } money, attack = \ deck_building_card.\ act_play_single_card(act, money, attack, player1) self.assertEqual([], player1['hand'])
def test_out_range_input(self): # input value out of the number of hand cards act = 3 money = 0 attack = 0 player1 = { 'name': 'player one', 'health': 30, 'deck': [], 'hand': [deck_building_card.Card('Archer', (3, 0), 2)], 'active': [], 'handsize': 5, 'discard': [] } money, attack = \ deck_building_card.\ act_play_single_card(act, money, attack, player1) self.assertEqual(1, len(player1['hand']))
def test_cost(self): cost = deck_building_card.Card('Archer', (3, 0), 2).cost self.assertEqual(2, cost)
def test_name(self): name = deck_building_card.Card('Archer', (3, 0), 2).name self.assertEqual("Archer", name)
def test_money(self): money = deck_building_card.Card('Archer', (3, 0), 2).get_money() self.assertEqual(0, money)
def test_attack(self): attack = deck_building_card.Card('Archer', (3, 0), 2).get_attack() self.assertEqual(3, attack)