Book Image

Daniel Arbuckle's Mastering Python

By : Daniel Arbuckle
Book Image

Daniel Arbuckle's Mastering Python

By: Daniel Arbuckle

Overview of this book

Daniel Arbuckle's Mastering Python covers the basics of operating in a Python development environment, before moving on to more advanced topics. Daniel presents you with real-world solutions to Python 3.6 and advanced-level concepts, such as reactive programming, microservices, ctypes, and Cython tools. You don't need to be familiar with the Python language to use this book, as Daniel starts with a Python primer. Throughout, Daniel highlights the major aspects of managing your Python development environment, shows you how to handle parallel computation, and helps you to master asynchronous I/O with Python 3.6 to improve performance. Finally, Daniel will teach you the secrets of metaprogramming and unit testing in Python, helping you acquire the perfect skillset to be a Python expert. Daniel will get you up to speed on everything from basic programming practices to high-end tools and techniques, things that will help set you apart as a successful Python programmer.
Table of Contents (13 chapters)

Understanding the principle of unit testing

Testing is often something of an afterthought for programmers because it tends to be laborious and annoying. Also, we usually have a high degree of confidence in our work and testing it seems unnecessary. It's also a fact, though, that the confidence is often misplaced. Source code is a complex and subtle language, and it's easy to make mistakes while writing it and not even notice them. We all know this from experience, but that doesn't make it any easier to make time for something that is laborious, annoying, and feels unnecessary. The following flow diagram illustrates a simple example of testing:

So, the first question about testing is, How can we do it in a way that doesn't feel like a painful waste of time? Finding a way to overcome this psychological barrier is the first step toward creating a testing method...