Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Python

You're reading from  Learning Python

Product type Book
Published in Dec 2015
Publisher Packt
ISBN-13 9781783551712
Pages 442 pages
Edition 1st Edition
Languages
Author (1):
Fabrizio Romano Fabrizio Romano
Profile icon Fabrizio Romano
Toc

Table of Contents (20) Chapters close

Learning Python
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
1. Introduction and First Steps – Take a Deep Breath 2. Built-in Data Types 3. Iterating and Making Decisions 4. Functions, the Building Blocks of Code 5. Saving Time and Memory 6. Advanced Concepts – OOP, Decorators, and Iterators 7. Testing, Profiling, and Dealing with Exceptions 8. The Edges – GUIs and Scripts 9. Data Science 10. Web Development Done Right 11. Debugging and Troubleshooting 12. Summing Up – A Complete Example Index

Chapter 7. Testing, Profiling, and Dealing with Exceptions

 

"Code without tests is broken by design."

 
 --Jacob Kaplan-Moss

Jacob Kaplan-Moss is one of the core developers of the Django web framework. We're going to explore it in the next chapters. I strongly agree with this quote of his. I believe code without tests shouldn't be deployed to production.

Why are tests so important? Well, for one, they give you predictability. Or, at least, they help you achieve high predictability. Unfortunately, there is always some bug that sneaks into our code. But we definitely want our code to be as predictable as possible. What we don't want is to have a surprise, our code behaving in an unpredictable way. Would you be happy to know that the software that checks on the sensors of the plane that is taking you on holidays sometimes goes crazy? No, probably not.

Therefore we need to test our code, we need to check that its behavior is correct, that it works as expected when it deals with edge cases, that it...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime}