私は Learn Python the Hard Way をフォローしており、Exercise 47 - Automated Testing ( http://learnpythonthehardway.org/book/ex47.html )を行っています。
私は Python3 を使用しており (本では Python 2.x を使用しているのに対して)、assert_equals (本で使用されている) は非推奨であることに気付きました。assertEqual を使用しています。
テスト ケースを作成しようとしていますが、何らかの理由で cmd で NOSETEST を使用すると、次のエラーが発生します。NameError: global name 'assertEqual' is not defined
コードは次のとおりです。
from nose.tools import *
from ex47.game import Room
def test_room():
gold = Room("GoldRoom",
""" This room has gold in it you can grab. There's a
door to the north. """)
assertEqual(gold.name, "GoldRoom")
assertEqual(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})
assertEqual(center.go('north'), north)
assertEqual(center.go('south'), south)
def test_map():
start = Room("Start", "You can go west and down a 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})
assertEqual(start.go('west'), west)
assertEqual(start.go('west').go('east'), start)
assertEqual(start.go('down').go('up'), start)
GitHub で解決策を検索しようとしましたが、NameError が表示される理由と、それを修正する方法がわかりません。