Mercurial > hg > MakeItSo
comparison examples/doctest.txt @ 40:6b4c8f23192f
test and fix mixed output case
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sun, 02 Jan 2011 00:48:58 -0800 |
parents | a2cdce0108e1 |
children | 9a0014a760d1 |
comparison
equal
deleted
inserted
replaced
39:a2cdce0108e1 | 40:6b4c8f23192f |
---|---|
54 >>> shutil.rmtree(tempdir) | 54 >>> shutil.rmtree(tempdir) |
55 | 55 |
56 Mixed case: | 56 Mixed case: |
57 | 57 |
58 >>> template = makeitso.PolyTemplate([example, exampledir]) | 58 >>> template = makeitso.PolyTemplate([example, exampledir]) |
59 >>> variables = sorted(template.missing()) | |
60 >>> variables | |
61 ['bar', 'foo', 'name', 'subdir'] | |
59 | 62 |
63 You need to provide output for mixing files and directory templates: | |
64 | |
65 >>> variables = dict([(i, i.title()) for i in variables]) | |
66 >>> try: | |
67 ... template.substitute(**variables) | |
68 ... except AssertionError, e: | |
69 ... pass | |
70 >>> e | |
71 AssertionError('Must specify output ... | |
72 | |
73 Provide an output: | |
74 | |
75 >>> template = makeitso.PolyTemplate([example, exampledir], output=tempdir, interactive=False) | |
76 >>> template.substitute(**variables) | |
77 >>> sorted(os.listdir(tempdir)) | |
78 ['Subdir', 'example.txt', 'foo.txt'] | |
79 >>> shutil.rmtree(tempdir) |