title: Importing module Attribute Error, LPTHW ex47
body: <p>I'm doing <a href="http://learnpythonthehardway.org/book/ex47.html" rel="nofollow noreferrer">example 47</a> from &quot;Learn Python the hard way&quot;.</p>
  <p>And this is my code:</p>
  <pre><code>from nose.tools import*
  from ex47.game import Room
  
  def test_room():
  
      gold = Room(&quot;GoldRoom&quot;,
  
                  &quot;&quot;&quot;This room has gold in it you can grab. there's a door to the north.&quot;&quot;&quot;)
  
      assert_equal(gold.name, &quot;GoldRoom&quot;)
      assert_equal(gold.paths, {})
  
  def test_room_paths():
  
      center = Room(&quot;Center&quot;, &quot;Test room in the center.&quot;)
      north = Room(&quot;North&quot;, &quot;test room in the north.&quot;)
      south = Room(&quot;south&quot;, &quot;test room in the south.&quot;)
  
      center.add_paths({'north': north, 'south': south})
      assert_equal(center.go('north'), north) 
      assert_equal(center.go('south'), south)
  
  
  def test_map():
  
      start = Room(&quot;Start&quot;, &quot;You can go west and down a hole.&quot;)
      west = Room(&quot;Trees&quot;, &quot;There are trees here, you can go east.&quot;)
      down = Room(&quot;Dungeon&quot;, &quot;It's dark down here, you can go up.&quot;)
  
      start.add_paths({'west': west, 'down': down})
      west.add_paths({'east': start})
      down.add_paths({'up': start})
  
      assert_equal(start.go('west'), west)
      asset_equal(start.go('west').go('east'), start)
      assert_equal(start.go('down').go('up'), start)
  </code></pre>
  <p>However, when testing this code using nosetest I get an error:</p>
  <pre><code>Traceback &lt;most recent call last&gt;:
  File &quot;c:\Python31\lib\site-packages\nose\case.py&quot;, line 197,in runtest
      self.test&lt;*self.arg&gt;
  File &quot;C:\path\Ex47\skeleton\tests\ex47_tests.py&quot;, line 28, in test_map
      start.add_paths&lt;{'west': west, 'down':down&gt;}
  AttributeError: 'Room' object has no attribute 'add_paths'
  </code></pre>
  <hr />
  <pre><code>Ran 3 tests in 0.030s
  
  FAILED &lt;errors=2&gt;
  </code></pre>
  <p>This seems to be ridiculous since <code>add_paths</code> worked fine in <code>test_room_paths()</code>.</p>
  <p>I'm using Python 3.1, Windows 7.</p>
  <p>Here is the code for <code>game.py</code> just in case you need it:</p>
  <pre class="lang-py prettyprint-override"><code>class Room(object):
  
      def __init__(self, name, description):
          self.name = name
          self.description = description
          self.paths = {}
  
      def go(self, direction):
          return self.paths.get(direction, None)
  
  
      def add_paths(self, paths):
          self.paths.update(paths)    
  </code></pre>