Python NameError: global name 'assertEqual' is not defined -


i'm following learn python hard way , i'm on exercise 47 - automated testing (http://learnpythonthehardway.org/book/ex47.html)

i using python3 (vs book's use of python 2.x) , realize assert_equals (which used in book) deprecated. using assertequal.

i trying build test case reason, when using nosetests in cmd, error: nameerror: global name 'assertequal' not defined

here code:

from nose.tools import * ex47.game import room    def test_room():     gold = room("goldroom",         """ room has gold in can grab. there's             door north. """)     assertequal(gold.name, "goldroom")     assertequal(gold.paths, {})  def test_room_paths():     center = room("center", "test room in center.")     north = room("north", "test room in north.")     south = room("south", "test room in 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 , down hole")     west = room("trees", "there trees here. can go east.")     down = room("dungeon", "it's dark down here. 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) 

i've tried searching github solutions, , i'm not sure why it's giving me nameerror , how go fixing it.

assertequal method of unittest.testcase class. can use on objects inheret form class. check documentation at: http://docs.python.org/dev/library/unittest.html


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -