2021-04-06T15:54:26Z
How to Write Unit Tests in Python, Part 2: Game of Life
This is the second part of my series on unit testing Python applications. In this article I will introduce you to Conway's Game of Life, an interesting simulation that plays animated patterns on a grid.

My implementation of this game has an engine part, where the data structures and algorithm of the simulation are implemented, and a graphical user interface (GUI) part. In this article I will focus on testing the engine (testing GUIs will be covered in a future article).
Testing this code will present us with a few new challenges. In this article you will learn about the following topics:
- Test parametrization
- Building test matrices
- Basic mocking
- Testing Python exceptions