Hi all,
basically I have tried everything and I am still getting this error. I set PYTHONPATH, I made sure the init files have the dunder, I made sure to run on Powershell (I normally use Atom, no luck there either). I looked up and down on stack, I got nothing.
Here is my structure:
ex47
— bin
— docs
— ex47_main
------ __init__py
------ game.py
— tests
------ init.py
------ ex47_tests.py
— setup.py
And here is my code:
from ex47_main.game import Room
import unittestclass testFunc(unittest.TestCase):
def test_room(self):
gold = Room(“GoldRoom”, “”“This room has gold in it you can grab. There’s a
door to the north”"")
self.assertEqual(gold.name, “GoldRoom”)
self.assertEqual(gold.paths, {})def test_room_paths(self): 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}) self.assertEqual(center.go('north'), north) self.assertEqual(center.go('south'), south) def test_map(self): start = Room("Start", "You can go west and down a hole.") west = Room("Trees", "There are trees there, 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}) self.assertEqual(start.go('west'), west) self.assertEqual(start.go('west').go('east'), start) self.assertEqual(start.go('down').go('up'), start)
if name == ‘main’:
unittest.main()
If I use this code instead it works great.
import sys
sys.path.insert(1, ‘/Users/Panagiotis/Downloads/LPTHW/Projects/ex47/’)from ex47_main.game import Room
import unittest
I am stumped…will someone please let me know what am I doing wrong?