annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 MakeItSo!
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 =========
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 Boilerplate:
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 >>> import makeitso
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 >>> import os
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 >>> from StringIO import StringIO
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 >>> example = os.path.join(here, 'example.txt')
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 Basic functionality:
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 >>> template = makeitso.PolyTemplate([example], interactive=False)
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 >>> template.missing()
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 set(['name'])
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 >>> template.substitute(name='foo')
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 None
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 Substitute to a buffer:
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 >>> buffer = StringIO()
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 >>> template = makeitso.PolyTemplate([example], output=buffer, interactive=False)
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 >>> template.substitute(name='bar')
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 None
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25 >>> buffer.getvalue()
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26