Mercurial > hg > MakeItSo
diff examples/doctest.txt @ 65:0152741621c1
check in a failing test wrt location
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 07 Jan 2011 10:17:48 -0800 |
parents | 9a0014a760d1 |
children | a0f7bfa98755 |
line wrap: on
line diff
--- a/examples/doctest.txt Thu Jan 06 18:04:58 2011 -0800 +++ b/examples/doctest.txt Fri Jan 07 10:17:48 2011 -0800 @@ -35,7 +35,7 @@ 'Hello fleem' >>> os.remove(buffer) -Directory case: +Directory case:: >>> exampledir = os.path.join(here, 'directory-example') >>> tempdir = tempfile.mkdtemp() @@ -53,14 +53,14 @@ 'It' >>> shutil.rmtree(tempdir) -Mixed case: +Mixed case:: >>> template = makeitso.PolyTemplate([example, exampledir], interactive=False) >>> variables = sorted(template.missing()) >>> variables ['bar', 'foo', 'name', 'subdir'] -You need to provide output for mixing files and directory templates: +You need to provide output for mixing files and directory templates:: >>> variables = dict([(i, i.title()) for i in variables]) >>> try: @@ -70,10 +70,19 @@ >>> e AssertionError('Must specify output ... -Provide an 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) + +Test API templates:: + + >>> from makeitso.template import MakeItSoTemplate, Variable + >>> class MyTemplate(MakeItSoTemplate): + ... name = 'foo' + ... templates = ['example.txt'] + ... vars = [Variable(name='name', default='bar')] + >>> apitemplate = MyTemplate()