How should I unit test?

Ideally, you should be following TDD principles, if you’re not familar with them then I recommend watching the following video from Uncle Bob. TDD can provide instant feedback on whether or not the code you’re writing is doing the correct thing, which can be very useful particularly in complex applications that are hard to test […]

Unit Testing with Python (Part 3) – More Mocking!

Before reading this post I’d recommend reading my previous ones available here and here. In the previous tutorial we used unittest.mock to mock out our test subject’s dependencies, this simplified our tests and allowed us to focus on one piece of functionality at a time. Unfortunately the approach detailed previously has a drawback! Let’s make […]

Unit Testing with Python (Part 1) – A Simple Test

This tutorial will be the first in a small series about writing unit tests in Python, the reason it’s being split is mostly because I am learning more about it as I write! The examples below are written to Python 2.7 though I will cover 3 in the future to highlight their differences. I will […]

Python JSON Tutorial

The JSON module is part of the Python standard library and provides an easy to use way of dealing with JSON data types. This tutorial servers as a basic introduction to this very useful module. Python to JSON table The first place to start is the Python to JSON table (defined in the documentation) which […]

pyinvaders and a Pygame cheat sheet

Recently I had a bit of a blast from the past when I found an old Pygame project. If you’ve not used Pygame before; Pygame is a set of Python modules designed for writing games. Pygame adds functionality on top of the excellent SDL library. This allows you to create fully featured games and multimedia […]