Ejemplo n.º 1
0
def test_place_mushroom_bigger_world():
    """
    Check that the world is bigger
    """

    env = Environment(10, 10, 10, 10)
    world_size = len(env.world)
    env.place_mushroom(0b1111100000)
    assert len(env.world) == world_size + 1
Ejemplo n.º 2
0
def test_place_mushroom_world_full():
    """
    Check that the WorldFull is raised if world is full
    and placing a mushroom
    """

    env = Environment(2, 2, 2, 2)
    with pytest.raises(WorldFull):
        env.place_mushroom(0b0000011111)
Ejemplo n.º 3
0
def test_reset_mushrooms_placed():
    """
    Ensure that a reset world is empty
    """

    env = Environment(10, 10, 10, 10)
    env.place_mushroom(0b111110000)
    env.reset()
    assert len(env.world) == env.num_edible + env.num_poisonous