Mercurial > hg > MakeItSo
view examples/doctest.txt @ 35:7e47ff4b0cd3
started writing tests; what a surprise, everything is broken ;)
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sat, 01 Jan 2011 21:58:34 -0800 |
parents | |
children | 0cba953a03ca |
line wrap: on
line source
MakeItSo! ========= Boilerplate: >>> import makeitso >>> import os >>> from StringIO import StringIO >>> example = os.path.join(here, 'example.txt') Basic functionality: >>> template = makeitso.PolyTemplate([example], interactive=False) >>> template.missing() set(['name']) >>> template.substitute(name='foo') None Substitute to a buffer: >>> buffer = StringIO() >>> template = makeitso.PolyTemplate([example], output=buffer, interactive=False) >>> template.substitute(name='bar') None >>> buffer.getvalue()