diff 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
line wrap: on
line diff
--- a/examples/doctest.txt	Sat Jan 01 23:00:59 2011 -0800
+++ b/examples/doctest.txt	Sun Jan 02 00:48:58 2011 -0800
@@ -56,4 +56,24 @@
 Mixed case:
 
     >>> template = makeitso.PolyTemplate([example, exampledir])
+    >>> variables = sorted(template.missing())
+    >>> variables
+    ['bar', 'foo', 'name', 'subdir']
 
+You need to provide output for mixing files and directory templates:
+
+    >>> variables = dict([(i, i.title()) for i in variables])
+    >>> try:
+    ...    template.substitute(**variables)
+    ... except AssertionError, e:
+    ...    pass
+    >>> e
+    AssertionError('Must specify output ...
+
+Provide an output:
+
+    >>> template = makeitso.PolyTemplate([example, exampledir], output=tempdir, interactive=False)
+    >>> template.substitute(**variables)
+    >>> sorted(os.listdir(tempdir))
+    ['Subdir', 'example.txt', 'foo.txt']
+    >>> shutil.rmtree(tempdir)