In this post I take an existing script and write unit tests for it. This exercise got me a good grasp of testing code, it even led to catching a bug and doing a couple of small refactorings. I also learned to use mock to test the Twitter API (tweepy).

Writing tests after code is better than no tests at all, however I am currently learning more TDD (test driven development) which dictates that you write your tests first (hence ‘drive’ your design). I will do another video soon about how this changes the way you code …

The code of this post/ video is here


Bob Belderbos

I build useful apps and share my learning About me