04.08.2014 Views

o_18ufhmfmq19t513t3lgmn5l1qa8a.pdf

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 />

to filename.<br />

What Now?<br />

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

libraries; you’ve seen how to 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 to 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 to pop the cover and tweak the engine with some<br />

low-level tools. (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!