コード例 #1
0
def test_random_available_position_world_full():
    """
    Check that an exception is thrown when the world is full
    """

    env = Environment(4, 4, 8, 8)
    with pytest.raises(WorldFull):
        env.random_available_position()
コード例 #2
0
def test_random_available_position():
    """
    Check that the closest mushroom is correctly returned
    """

    env = Environment(10, 10, 40, 40)
    for _ in range(10):
        assert env.get_cell(env.random_available_position()) == 0