3

Ok, I'm trying to learn Python with "Learn Python the Hard Way" book by Zed Shaw and everything seems fine until the Exercise 47. There is a couple of very misleading notions in this exercise and the previous one. In previous exercise we were told to apply the following structure to our projects (here is how it looks in ex47.py):

./bin:
__init__.py __init__.pyc

./docs:

./ex47:
__init__.py __init__.pyc    game.py     game.pyc

./tests:
__init__.py __init__.pyc    ex47_tests.py   ex47_tests.pyc

In previous exercise Zed told us to put some script in bin and modules to the folder, named after the project. I don't understand how exactly the script differs from the module, but OK. In exercise ex47 we are running automated tests with nosetests and they run OK from the root directory of the project, however Zed says that we should see:

$ python ex47.py

And this is not what I see. I see something like number of tests run, time and etc. Moreover I can't run the project with ex47.py from the root since there is no such file and there shouldn't be according to Zed. What am I doing wrong?

4

1 回答 1

3

“你应该看到的”没有什么意义,很可能是一个编辑错误。相反,请注意文本解释(例如它们是)和整个练习的目标。本质上,您正在寻找的是表明所有测试都通过的输出 - 请特别注意下一个建议是故意导致其中一个测试失败,以便您可以看到输出的差异。

如果您可以区分“所有测试通过”和“至少一项测试失败”(以及确定哪个测试通过),那么您已经完成了练习的要点。

于 2013-04-19T09:52:17.440 回答