Mercurial > hg > MakeItSo
view examples/doctest.txt @ 36:0cba953a03ca
fixed single-file test case
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sat, 01 Jan 2011 22:13:33 -0800 |
parents | 7e47ff4b0cd3 |
children | 7cee2869bd7b |
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') Hello foo Substitute to a buffer: >>> buffer = StringIO() >>> template = makeitso.PolyTemplate([example], output=buffer, interactive=False) >>> template.substitute(name='bar') >>> buffer.getvalue().strip() 'Hello bar'