示例#1
0
 def setUp(self):
     self.ally = player.Player("ally", 12)
     self.enemy = player.Player("ennemy", 12)
     self.player_yaml = {'name': 'Rotovino',
                         'hp': 10,
                         'ac': 10,
                         'bab': 1}
示例#2
0
 def setUp(self):
     player_one_yaml = {'name': 'Rotovino',
                        'hp': 10,
                        'ac': 10,
                        'bab': 1}
     player_two_yaml = {'name': 'Fubar',
                        'hp': 12,
                        'ac': 10,
                        'bab': 0}
     self.player_single_raw_yaml = yaml.dump([player_one_yaml])
     self.player_multi_raw_yaml = yaml.dump([player_one_yaml, player_two_yaml])
     self.expected_player_one = player.Player('Rotovino', 10, 10, 1)
     self.expected_player_two = player.Player('Fubar', 12, 10, 0)
     pass
示例#3
0
 def setUp(self):
     self.ally = player.Player(12, 20, 10)
     self.enemy = player.Player(12, 10, 1)
示例#4
0
 def test_rounds_ally_lose(self):
     self.ally = player.Player("ally", 5)
     self.enemy = player.Player("enemy", 20)
     ally, enemy = combat.rounds(self.ally, self.enemy)
     self.assertTrue(enemy.is_alive())
     self.assertFalse(ally.is_alive())
示例#5
0
 def test_load_from_valid_yaml_player_has_same_attributes(self):
     expected_player = player.Player('Rotovino', 10, 10, 1)
     not_null_player = player.Player.load_from_yaml(self.player_yaml)
     self.assertEqual(expected_player, not_null_player)
示例#6
0
 def test_attack_no_attack_if_not_alive(self):
     dead_player = player.Player("dead", 0)
     expected_hp = self.enemy.hp
     enemy = dead_player.attack(self.enemy)
     actual_hp = enemy.hp
     self.assertEqual(expected_hp, actual_hp)
示例#7
0
 def test_player_is_equal_when_bab_are_equals(self):
     player_one = player.Player('', 0, bab=1)
     player_two = player.Player('', 0, bab=1)
     unequal_player_by_bab = player.Player('', 0, bab=2)
     self.assertEqual(player_one, player_two)
     self.assertNotEqual(player_one, unequal_player_by_bab)
示例#8
0
 def test_player_is_equal_when_name_are_equals(self):
     player_one = player.Player('test', 0)
     player_two = player.Player('test', 0)
     unequal_player_by_name = player.Player('unequal', 0)
     self.assertEqual(player_one, player_two)
     self.assertNotEqual(player_one, unequal_player_by_name)