Running Nosetest on Ex47?

I understand now. The program did run, it just had nothing to display as no functions were called. This is why there were no error messages. I tried to include print statements, but those did not print anything, which I assume is because I did not call the function.

I thought would run as I did not understand that “testing” the code meant using nosetests, instead of running the program using a python command. This is why the nil result confused me.

I am assuming that nosetests catches failures that would not show up when running modules(?) using the python command on its own.

Yep, bingo! Now you get it. Basically, the code is just fine. You just have to use nosetests to run the test code. You should also take a look at pytest:

It is a little easier to use and is actually maintained.

Hi Zed,
While on ex47, I ran into a problem with nosetests. Nosetests ran 3 tests on my ex47 and returned 3 fails all indicating the same TypeError: object() takes no parameters. The first error message is as follows:


File “/Users/mchen/projects/ex47/”, line 8, in test_room
“”" This room has gold in it you can grab. There’s a door to the north.""")
TypeError: object() takes no parameters

Could you shed some light on where the problems are? Thanks.

I found out it is my own error to blame. The error message is caused by my mis-spelling of init in class Room and has nothing to do with nosetests. My bad.


Then I guess the test worked!