예제 #1
0
def test_moved_player_and_items_in_level_display(p1, item_room):
    expected = [ 
        "....G",
        "$...*",
        "~....",
        "<....",
        ">@..."]
    level = item_room.enter(p1, "entrance")
    p1.travel("e")
    actual = level.draw_map()
    assert "\n".join(expected) == actual
예제 #2
0
def test_that_player_can_move_west(p1, test_room):
    level = test_room.enter(p1, "entrance")
    p1.travel("w")
    coords = p1.locate()
    assert 4 == coords[0]
    assert 6 == coords[1]
예제 #3
0
def test_that_player_can_move_south(p1, test_room):
    level = test_room.enter(p1, "entrance")
    p1.travel("s")
    coords = p1.locate()
    assert 5 == coords[0]
    assert 5 == coords[1]
예제 #4
0
def test_that_player_cannot_move_west_through_the_level_boundary(p1, tiny_room):
    level = tiny_room.enter(p1, "exit")
    assert level.can_go_west(p1)
    p1.travel("w")
    assert not level.can_go_west(p1)
예제 #5
0
def test_that_player_cannot_move_north_through_the_level_boundary(p1, tiny_room):
    level = tiny_room.enter(p1, "entrance")
    assert level.can_go_north(p1)
    p1.travel("n")
    assert not level.can_go_north(p1)