I have been working my way through Learn Python 3 The Hard way by Zed Shaw
and I have recently encountered a huge issue. So the book itself is outdated and examples included in the book make use of the nose
module which apparently isn't supported anymore. I managed to make my way through most of these examples by tedious research, but I'm now on page 202 and Zed imports the following module from nose.tools import *
which enables him to use assert
(whatever that does) and I cannot for the sake of me, find an equivalent import in nose2
that would also enable that function
here's the code:
from nose2.tools import *
from ex47.game import Room
def test_room():
gold = Room("GoldRoom",
"""This room has gold in it yo
u can grab. There's a door to the north""")
assert_equal(gold.name, "GoldRoom")
assert_equal(gold.paths, {})
def test_room_paths():
center = Room("Center", "Test room in the center.")
north = Room("North", "Test room in the north.")
south = Room("South", "Test room in the south.")
center.add_paths({"north": north, "south": south})
assert_equal(center.go("north"), north)
assert_equal(center.go("south"), south)
def test_map():
start = Room("Start", "you can go west and down the hole.")
west = Room("Trees", "There are trees here, you can go east.")
down = 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})
assert_equal(start.go('west'), west)
assert_equal(start.go('west').go('east'), start)
assert_equal(start.go("down").go('up'), start)
If someone could please give me an alternative import in nose2
i'd be forever grateful.