Example #1
0
File: tests.py Project: caasig1/Tag
 def test_handle_collision_do_not_eliminate(self):
     game = games.EliminationTag(10, self.tree, 3, 4)
     player1 = list(game._players)[0]
     player2 = next(name for name, p in game._players.items()
                    if player1 not in p.get_targets())
     dir1 = game._players[player1]._direction
     dir2 = game._players[player2]._direction
     game.handle_collision(player1, player2)
     assert player1 in game._players
     assert player2 in game._players
Example #2
0
File: tests.py Project: caasig1/Tag
 def test_handle_collision_one_is_target(self):
     game = games.EliminationTag(10, self.tree, 3, 4)
     player1 = list(game._players)[0]
     player2 = game._players[player1].get_targets()[0]
     p2targets = game._players[player2].get_targets()
     points = game._players[player1].get_points()
     game.handle_collision(player1, player2)
     assert player1 in game._players
     assert player2 not in game._players
     assert game._players[player1].get_targets()[0] == p2targets[0]
     assert game._players[player1].get_points() - 1 == points
Example #3
0
File: tests.py Project: caasig1/Tag
 def test_init(self):
     game = games.EliminationTag(10, self.tree, 3, 4)
     assert len(game._players) == 10
     assert all(name in game.field for name in game._players)
     assert all(player._colour == 'random'
                for _, player in game._players.items())
     player = list(game._players.values())[0]
     players = set()
     while player not in players:
         players.add(player)
         player = game._players[player.get_targets()[0]]
     # check to make sure that all players are targeting each other correctly
     assert len(players) == 10
Example #4
0
File: tests.py Project: caasig1/Tag
 def test_check_for_winner_one_winner(self):
     game = games.EliminationTag(10, self.tree, 3, 4)
     player1 = list(game._players)[0]
     game._players[player1].increase_points(1)
     assert game.check_for_winner() == player1
Example #5
0
File: tests.py Project: caasig1/Tag
 def test_check_for_winner_no_winner(self):
     game = games.EliminationTag(10, self.tree, 3, 4)
     assert game.check_for_winner() is None