Skip to Main Content
Python for Secret Agents
book

Python for Secret Agents

by Steven F. Lott
August 2014
Beginner to intermediate content levelBeginner to intermediate
216 pages
5h 13m
English
Packt Publishing
Content preview from Python for Secret Agents

Writing high-quality software

How do we know these various statistical functions work? This is potentially very tricky programming, with lots of opportunities to have things go wrong.

The best tool to make sure that software works is unit testing. The idea behind unit testing is to break a module down into separate units—usually functions or classes—and test each unit in isolation. Python gives us two ways to perform unit testing:

  • Putting examples into docstrings for modules, functions, and classes
  • Writing separate unittest.TestCase classes

Most secret agents will be very happy with docstring test cases. They're easy to write. We put them in the docstring right in front of the rest of the code. They're visible when we use the help() function.

We create ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python for Secret Agents - Volume II - Second Edition

Python for Secret Agents - Volume II - Second Edition

Steven F. Lott

Publisher Resources

ISBN: 9781783980420Supplemental Content