Beispiel #1
0
def test_room_paths():
    center = planisphere.Room('Center', 'Test room in the center')
    north = planisphere.Room('North', 'Test room in the north')
    south = planisphere.Room('South', 'Test room in the south')
    center.add_paths({'north': north, 'south': south})

    assert center.go('south') == south
    assert center.go('north') == north
Beispiel #2
0
def test_room_path():
    center = game.Room('Center', 'Test room center')
    north = game.Room('North', 'Test room north')
    south = game.Room('South', 'Test room south')

    center.add_paths({'north': north, 'south': south})
    nt.assert_equal(center.go('north'), north)
    nt.assert_equal(center.go('south'), south)
Beispiel #3
0
def test_map():
    start = game.Room('Start', 'You can go west and down a hole')
    west = game.Room('Trees', 'There are trees here, you can go east')
    down = game.Room('Dungeon', 'It\'s dark down here, you can go up')

    start.add_paths({'west': west, 'down': down})
    west.add_paths({'east': start})
    down.add_paths({'up': start})

    nt.assert_equal(start.go('west'), west)
    nt.assert_equal(start.go('west').go('east'), start)
    nt.assert_equal(start.go('down').go('up'), start)
Beispiel #4
0
def test_map():
    start = planisphere.Room("Start",
                             "You can go west and fall down in a cave")
    west = planisphere.Room("Trees",
                            "There are only trees here, you can go east.")
    down = planisphere.Room(
        "Dungeon", "how did you get here? Get back to the planisphere!")

    start.add_paths({'west': west, 'down': down})
    west.add_paths({'east': start})
    down.add_paths({'up': start})

    assert start.go('west') == west
    assert start.go('west').go('east') == start
    assert start.go('down').go('up') == start
Beispiel #5
0
def test_Room():
    room = planisphere.Room(
        'GoldRoom',
        """This room has gold in it you can grab. There is a door to the north."""
    )
    assert room.name == 'GoldRoom'
    assert 'This room has gold' in room.description
    assert room.paths == {}
Beispiel #6
0
def test_room():
    gold = game.Room('GoldRoom', 'This room has gold in it')

    nt.assert_equal(gold.name, 'GoldRoom')
    nt.assert_equal(gold.path, {})