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.
Python 3 dictionary is a versatile and easy to use hash-map implementation. It is simply a built-in data type that you can hack upon.
Python 3 sequence slicing is a pythonic way of accessing a portion of a sequence. Slicing copies, the selected data to a new sequence of same type (Shallow copy).
Major python 3 sequence types are str, bytes, bytearray, list, tuple and range. This tutorial focuses on how to create and access sequences.
Python 3 while loop is very easy to use. Syntax is simpler than for loop and its usages are limitless.
In this tutorial we are going to build a small class structure to access a to-do table. Python is batteries included language. So obviously it has the necessary tools and APIs built in.
For loops are one of the basic iterative structures available in most programming languages. You’ll also find that there is a variant of typical for loops called foreach loops that lets you access elements of a sequence. In python 3, the for loop works similarly to the foreach loop.
So in previous tutorials we got our hands dirty with some quick and easy code. Now we are going to dabble with some serious stuff using Python 3 Script Syntax. Continue reading