Mercurial > hg > MakeItSo
comparison 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 |
comparison
equal
deleted
inserted
replaced
34:46c2d0a7335a | 35:7e47ff4b0cd3 |
---|---|
1 MakeItSo! | |
2 ========= | |
3 | |
4 Boilerplate: | |
5 | |
6 >>> import makeitso | |
7 >>> import os | |
8 >>> from StringIO import StringIO | |
9 >>> example = os.path.join(here, 'example.txt') | |
10 | |
11 Basic functionality: | |
12 | |
13 >>> template = makeitso.PolyTemplate([example], interactive=False) | |
14 >>> template.missing() | |
15 set(['name']) | |
16 >>> template.substitute(name='foo') | |
17 None | |
18 | |
19 Substitute to a buffer: | |
20 | |
21 >>> buffer = StringIO() | |
22 >>> template = makeitso.PolyTemplate([example], output=buffer, interactive=False) | |
23 >>> template.substitute(name='bar') | |
24 None | |
25 >>> buffer.getvalue() | |
26 |