Произошло ли изменение assert_equal в python? - PullRequest
0 голосов
/ 18 апреля 2020

В настоящее время я учусь python, и я изучаю это из книги "Учиться Python трудный путь". В книге используется python 3,6, а у меня установлена ​​python 3.8.2. Я в упражнении 47 и застрял здесь. VSCode показывает, что asset_equal не определен. Я попытался написать assert_equals и asserEquals вместо assert_equal. Итак, assert_equal был заменен, или я сделал что-то не так, или у него есть какие-либо предварительные требования? вот код:

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 is 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 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})

  assert_equal(start.go('west'), west)
  assert_equal(start.go('west').go('east'), start)
  assert_equal(start.go('down').go('up'), start)
...