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.
Reflection is a useful feature in Java that allows you to programmatically navigate and manipulate an object. Java frameworks created for Object Relational Mapping (Hibernate, etc..) and Testing (JUnit, TestNG) utilizes reflection. Also, you can use reflection to simply access private member values and methods. (Sometimes required when you are dealing with third party code).
Are you a cry baby who cannot find things on the internet? Want to become an Internet Search Ninja? Don’t know where to look? Here’s a tutorial for ya! Let’s learn how to improve google search results the right way.
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.