In the previous tutorial, we introduced you to a little test driven development with Python (TDD). Welcome! to the second part of our Python TDD tutorial. Here we are going to continue the development of propers library.
Let’s walk through TDD Python. Doing a Python test is very easy. I have written unit tests in Python, Java and C++, utilizing Google Test, Google Mock, JUnit, TestNG, Mockito and Powermock (Powermock+mockito). Python 3 is the easiest to test of them all. Python 3 being batteries included, comes with both a unit testing framework and a mocking framework. Let’s do some Test-Driven Development with Python 3.
Python dictionary is an easy to use data structure. In the previous tutorial I covered creating, setting values, deleting values and checking existence of a key. For this tutorial I am going to cover how to access keys, values and items, how to use dictionary comprehension and many more.
One of my favorite books on coding is Clean Code by Robert C. Martin. Here’s one of the most important concepts that caught my eye: Readable code is important. You need to write code for people and not for machines. So what does reading good code have anything to do with writing it? Let’s find out.