Esempio n. 1
0
def test_wrong_input_action_length(game_name, real_num_agent, real_num_action):
    game = MatrixGame(game_name, real_num_agent, real_num_action)
    with pytest.raises(WrongActionInputLength) as excinfo:
        game.step([10] * (real_num_agent + 1))

    assert f"Expected number of actions is {real_num_agent}" in str(
        excinfo.value)
Esempio n. 2
0
def test_create_wrong_name_game():
    with pytest.raises(EnvironmentNotFound) as excinfo:
        game = MatrixGame("abc", 2, 2)

    assert "abc" in str(excinfo.value)
Esempio n. 3
0
def test_wrong_num_action(game_name, real_num_agent, real_num_action):
    with pytest.raises(WrongNumberOfAction) as excinfo:
        game = MatrixGame(game_name, real_num_agent, 10)

    assert f"for {game_name} is {real_num_action}" in str(excinfo.value)
    assert "action" in str(excinfo.value)
Esempio n. 4
0
def test_create_game():
    game = MatrixGame("zero_sum_nash_0_1", 2, 2)