O'Reilly logo

Learning Python Testing by Daniel Arbuckle

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using tests to get the code right

All right, so that code looks fairly good. Unfortunately, Nose tells us that there are a few problems. Actually, Nose reports quite a large number of problems, but a lot of them seem to be related to a few root causes.

First, let's address the problem that, though the Activity and Status classes don't seem to have the exclude methods, some of our code tries to call that method. A typical report of this problem from the Nose output looks like a traceback followed by:

AttributeError: 'Activity' object has no attribute 'exclude'

Looking at our code, we see that it is properly called excludes. The tracebacks included in the Nose error report tell us that the problem is on line 51 of planner/data.py, and it looks like ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required