I was asked to review a new book by Packt Publishing called Test-Driven Python Development. I was really excited because it combined two of my three favorite programming topics that I can’t seem to stop reading about: Python and TDD/Unit Testing.
The book has many editing mistakes, but does a great, in-depth job of explaining TDD and good testing in Python.
The first thing I noticed about this book was the size of its font. In my kindle app, even with the text display size turned all the way down, I couldn’t get 80 characters across the screen, even in landscape. I submitted a complaint and they’re supposedly looking at it.
The opening chapters were a great, quick introduction to TDD. They may go a little bit fast for a pure beginner, but I doubt it. Unfortunately, the book went quickly from TDD to simply being about unit testing, showing the tests after the “production” code. The author stated that putting the tests later would make everything easier to understand. I disagree, and I feel like it hurts his point a lit, even with him assuring the reader that he wrote the tests first.
But, he still did a good job of getting across what he needed to.
As I said, the font is too big. Also, Packt Publishing didn’t do the best job editing the book.
There are quite a few (not a LOT, but enough to be a pretty annoying to a guy like me) mistakes of all kinds. Missing words, code mistakes, typos, etc.
And, again, I didn’t like the switch away from tests before code in the book.
The book is great at introducing TDD and unit testing in python, then really digging into the more advanced stuff, eventually getting into working with legacy code, test suite maintenance, moving beyond the unittest module to nose2, and some other tools such as PyHamcrest, Trial, and Py.test.
This is the first thing I’ve read that explains Python’s built-in mocking framework very well. Most others seemed to assume that you had a basic understanding of how it worked. I’m actually looking forward to using Mock sometimes.
Overall, I really enjoyed the pacing. It doesn’t repeat too much and doesn’t move too quickly.
It’s actually a great book, really just needing better editors and smaller font. The shift away from showing tests first bugs me, but it largely is overshadowed by the fact that the author really knows a lot about what he’s writing.