Exemplo n.º 1
0
def wine_2(country_new, grape_2):
    return entities.Wine(
        id=entities.new_id(),
        name="Wine 2",
        color=entities.Wine.Color.RED,
        sugar=entities.Wine.Sugar.SWEET,
        country=country_new,
        grape=grape_2,
    )
Exemplo n.º 2
0
def wine_semi_sweet(country_old, grape):
    return entities.Wine(
        id=entities.new_id(),
        name="Wine Semi Sweet",
        color=entities.Wine.Color.RED,
        sugar=entities.Wine.Sugar.SEMI_SWEET,
        country=country_old,
        grape=grape,
    )
Exemplo n.º 3
0
def wine(country_old, grape):
    return entities.Wine(
        id=entities.new_id(),
        name="Wine",
        color=entities.Wine.Color.RED,
        sugar=entities.Wine.Sugar.SWEET,
        country=country_old,
        grape=grape,
    )
Exemplo n.º 4
0
def game(user, user_2, wine, wine_2):
    g = entities.Game(id=entities.new_id(), name="Game")
    g.add_player(user)
    g.add_player(user_2)

    g.add_round(wine)
    g.add_round(wine_2)

    return g
Exemplo n.º 5
0
def wine_country_ex_ussr(country_ex_ussr, grape):
    return entities.Wine(
        id=entities.new_id(),
        name="Wine Country Ex Ussr",
        color=entities.Wine.Color.RED,
        sugar=entities.Wine.Sugar.DRY,
        country=country_ex_ussr,
        grape=grape,
    )
Exemplo n.º 6
0
def wine_country_new(country_new, grape):
    return entities.Wine(
        id=entities.new_id(),
        name="Wine Country New",
        color=entities.Wine.Color.RED,
        sugar=entities.Wine.Sugar.DRY,
        country=country_new,
        grape=grape,
    )
Exemplo n.º 7
0
def wine_dry(country_old, grape):
    return entities.Wine(
        id=entities.new_id(),
        name="Wine Dry",
        color=entities.Wine.Color.RED,
        sugar=entities.Wine.Sugar.DRY,
        country=country_old,
        grape=grape,
    )
Exemplo n.º 8
0
def test_add_player_into_game(user, user_2, user_3):
    g = entities.Game(id=entities.new_id(), name="First game")

    g.add_player(user)
    assert g.get_player_state(user) == PlayerState(
        user=user, balance=entities.Game.STARTING_BALANCE)

    g.add_player(user_2)
    assert g.get_player_state(user_2) == PlayerState(
        user=user_2, balance=entities.Game.STARTING_BALANCE)

    assert g.players == [
        PlayerState(user=user, balance=entities.Game.STARTING_BALANCE),
        PlayerState(user=user_2, balance=entities.Game.STARTING_BALANCE),
    ]

    with pytest.raises(errors.PlayerAlreadyExistsError):
        g.add_player(user)

    with pytest.raises(errors.PlayerNotFound):
        assert g.get_player_state(user_3) is None
Exemplo n.º 9
0
def country_old():
    return entities.Country(
        id=entities.new_id(),
        name="France",
        part_of_world=entities.Country.PartOfWorld.OLD_WORLD,
    )
Exemplo n.º 10
0
def user_3():
    return entities.User(id=entities.new_id(), name="user_3")
Exemplo n.º 11
0
def grape_2():
    return entities.Grape(id=entities.new_id(), name="Grape 2")
Exemplo n.º 12
0
def country_ex_ussr():
    return entities.Country(
        id=entities.new_id(),
        name="Georgia",
        part_of_world=entities.Country.PartOfWorld.EX_USSR,
    )
Exemplo n.º 13
0
def game_without_rounds(user, user_2):
    g = entities.Game(id=entities.new_id(), name="Game")
    g.add_player(user)
    g.add_player(user_2)
    return g
Exemplo n.º 14
0
def game_with_one_player(user):
    g = entities.Game(id=entities.new_id(), name="Game")
    g.add_player(user)
    return g
Exemplo n.º 15
0
def game_without_players():
    return entities.Game(id=entities.new_id(), name="Game")
Exemplo n.º 16
0
def country_new():
    return entities.Country(
        id=entities.new_id(),
        name="Chili",
        part_of_world=entities.Country.PartOfWorld.NEW_WORLD,
    )