16.01.2014 Views

Beginning Python - From Novice to Professional

Beginning Python - From Novice to Professional

Beginning Python - From Novice to Professional

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 16 ■ TESTING, 1-2-3 355<br />

New Functions in This Chapter<br />

Function<br />

doctest.testmod(module)<br />

unittest.main()<br />

profile.run(stmt[, filename])<br />

Description<br />

Check docstring examples. (Takes many more arguments.)<br />

Run the unit tests in the current module.<br />

Execute and profile statement. Optionally save results<br />

<strong>to</strong> filename.<br />

What Now?<br />

Now you’ve seen all kinds of things you can do with the <strong>Python</strong> language and the standard<br />

libraries; you’ve seen how <strong>to</strong> probe and tweak your code until it screams (if you got serious<br />

about profiling, despite my warnings). If you still aren’t getting the oomph you require, it’s<br />

time <strong>to</strong> reach for heavier weapons. In the words of Neo in The Matrix: We need guns. Lots of<br />

guns. In less metaphorical terms: It’s time <strong>to</strong> pop the cover and tweak the engine with some<br />

low-level <strong>to</strong>ols. (Wait, that was still metaphorical, wasn’t it?)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!