Book Image

Learning NumPy Array

By : Ivan Idris
Book Image

Learning NumPy Array

By: Ivan Idris

Overview of this book

Table of Contents (14 chapters)
Learning NumPy Array
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 6. Profiling, Debugging, and Testing

Profiling, debugging, and testing are an integral part of the development process. You are probably familiar with the concept of unit testing. Unit tests are automated tests written by a programmer to test his or her code. These tests could, for example, test a function or part of a function in isolation. Only a small unit of code is tested in each test. The benefits are increased confidence in the quality of the code, reproducible tests and, as a side effect, more clear and correct code. Unit testing also facilitates collaborative editing because, usually, no one understands all the code in a complex project themselves, so unit tests prevent contributors from breaking the existing code. Python has good support for unit testing. NumPy adds the numpy.testing package to help NumPy code the unit testing.

This chapter's topics include:

  • Asserts

  • Profiling

  • Debugging

  • Unit testing