def test_game_is_leading_alt_field(): """ Assert player is projected to lead the game """ a_game = Game() # Manually hack the scores for test a_game._scores = [ {"controlled": 2, "projected": 1}, {"controlled": 15, "projected": 1}, {"controlled": 2, "projected": 17}, {"controlled": 12, "projected": 2}, ] assert not a_game.is_leading(1, field="projected") assert a_game.is_leading(2, field="projected")
def test_game_is_leading(): """ Assert player is leading the game """ a_game = Game() # Manually hack the scores for test a_game._scores = [ {"controlled": 2, "projected": 1}, {"controlled": 15, "projected": 1}, {"controlled": 2, "projected": 17}, {"controlled": 12, "projected": 2}, ] assert a_game.is_leading(1) assert not a_game.is_leading(3)
def test_game_get_leaders_alt_field(): """ Grab the correct leader based on projected score """ a_game = Game() # Manually hack the scores for test a_game._scores = [ {"controlled": 2, "projected": 1}, {"controlled": 15, "projected": 1}, {"controlled": 2, "projected": 17}, {"controlled": 15, "projected": 2}, ] leaders = a_game.get_leaders("projected") assert len(leaders) == 1 assert leaders[0][0] == 2 assert leaders[0][1] == 17
def test_game_get_leaders(): """ Grab the correct leader based on current score """ a_game = Game() # Manually hack the scores for test a_game._scores = [ {"controlled": 2}, {"controlled": 15}, {"controlled": 2}, {"controlled": 4}, ] leaders = a_game.get_leaders() assert len(leaders) == 1 assert leaders[0][0] == 1 assert leaders[0][1] == 15
def test_game_is_leading_tied(): """ Assert tied players leading the game """ a_game = Game() # Manually hack the scores for test a_game._scores = [ {"controlled": 2, "projected": 1}, {"controlled": 15, "projected": 1}, {"controlled": 2, "projected": 17}, {"controlled": 15, "projected": 2}, ] # Not an outright lead when tied assert not a_game.is_leading(1) assert not a_game.is_leading(3) assert a_game.is_leading(1, outright=False) assert a_game.is_leading(3, outright=False)