Beispiel #1
0
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")
Beispiel #2
0
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)
Beispiel #3
0
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
Beispiel #4
0
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
Beispiel #5
0
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)