Mercurial > hg > MakeItSo
comparison examples/doctest.txt @ 39:a2cdce0108e1
get directory substitution sorta working; start stubbing mixed case
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Sat, 01 Jan 2011 23:00:59 -0800 |
| parents | 9739212a63c3 |
| children | 6b4c8f23192f |
comparison
equal
deleted
inserted
replaced
| 38:9739212a63c3 | 39:a2cdce0108e1 |
|---|---|
| 40 >>> exampledir = os.path.join(here, 'directory-example') | 40 >>> exampledir = os.path.join(here, 'directory-example') |
| 41 >>> tempdir = tempfile.mkdtemp() | 41 >>> tempdir = tempfile.mkdtemp() |
| 42 >>> template = makeitso.PolyTemplate([exampledir], output=tempdir, interactive=False) | 42 >>> template = makeitso.PolyTemplate([exampledir], output=tempdir, interactive=False) |
| 43 >>> sorted(template.missing()) | 43 >>> sorted(template.missing()) |
| 44 ['bar', 'foo', 'subdir'] | 44 ['bar', 'foo', 'subdir'] |
| 45 >>> template.substitute(foo='myfoo', bar='mybar', subdir='mysubdir') | 45 >>> template.substitute(foo='It', bar='life', subdir='mysubdir') |
| 46 >>> os.listdir(tempdir) | 46 >>> sorted(os.listdir(tempdir)) |
| 47 | 47 ['foo.txt', 'mysubdir'] |
| 48 >>> file(os.path.join(tempdir, 'foo.txt')).read().strip() | |
| 49 'It is a wonderful life' | |
| 50 >>> os.listdir(os.path.join(tempdir, 'mysubdir')) | |
| 51 ['life.txt'] | |
| 52 >>> file(os.path.join(tempdir, 'mysubdir', 'life.txt')).read().strip() | |
| 53 'It' | |
| 54 >>> shutil.rmtree(tempdir) | |
| 55 | |
| 56 Mixed case: | |
| 57 | |
| 58 >>> template = makeitso.PolyTemplate([example, exampledir]) | |
| 59 |
