Mercurial > mozilla > hg > licenser
changeset 18:c04a53145f19
interpolate the files, i hope
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 24 Nov 2011 14:50:24 -0800 |
parents | 4566b3ac9838 |
children | 73e815e13914 |
files | licenser/licenses.py tests/doctest.txt |
diffstat | 2 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/licenser/licenses.py Thu Nov 24 14:25:56 2011 -0800 +++ b/licenser/licenses.py Thu Nov 24 14:50:24 2011 -0800 @@ -106,7 +106,7 @@ """ determines if a file is empty; that is, contains only comments """ - for line in self.lines() + for line in self.lines(): line = line.strip() if line and line[0] != '#': return False @@ -120,7 +120,7 @@ variables = [] # required variables - def __init__(self, filetypes=self.filetypes[:]): + def __init__(self, filetypes=filetypes[:]): if self.template: if not os.path.isabs(self.template): self.template = os.path.join(os.path.dirname(__file__),
--- a/tests/doctest.txt Thu Nov 24 14:25:56 2011 -0800 +++ b/tests/doctest.txt Thu Nov 24 14:50:24 2011 -0800 @@ -4,9 +4,15 @@ The obligatory imports:: >>> import licenser + >>> from licenser import licenses >>> import os -Run some tests:: +Sanity check:: >>> assert os.path.exists(directory) +Test MPL license:: + + >>> license = licenses.MPL() + >>> variables = {'author': 'Jeff Hammel', 'email': 'k0s@k0s.org'} + >>> license.interpolate(directory, variables)