Tue Jan 2 12:21:56 2007
Ticket #115
--with-doctest fails totaly with some of the docstrings
| Priority: | highest | Reporter: | Pedro Algarvio, aka, s0undt3ch <ufs@ufsoft.org> |
|---|---|---|---|
| Severity: | blocker | Assigned to: | jpellerin |
| Component: | nose:plugin:doctest | Status: | new |
| Version: | 0.9.1 | Resolution: | |
| Milestone: | Keywords: |
Description by Pedro Algarvio, aka, s0undt3ch <ufs@ufsoft.org>:
nose's --with-doctest will fail with the following class doctest's:
class CatalogHeader: """Representation of a gettext catalog header""" def __init__(self, encoding='utf-8'): self.encoding = encoding self._comments = [] self._headers = { ProjectIdVersion: ( u'Project-Id-Version', u'PROJECT VERSION' ), ReportMsgidBugsTo: ( u'Report-Msgid-Bugs-To', u'ADDRESS@EMAIL' ), POTCreationDate: ( u'POT-Creation-Date', u'YEAR-MO-DA HO:MI+ZONE' ), PORevisionDate: ( u'PO-Revision-Date', u'YEAR-MO-DA HO:MI+ZONE' ), LastTranslator: ( u'Last-Translator', u'FULL NAME <EMAIL@ADDRESS>' ), LanguageTeam: ( u'Language-Team', u'LANGUAGE <LL@li.org>' ), MIMEVersion: ( u'MIME-Version', u'1.0' ), ContentType: ( u'Content-Type', u'text/plain; charset=UTF-8' ), ContentTransferEncoding: ( u'Content-Transfer-Encoding', u'8bit' ), PluralForms: ( u'Plural-Forms', u'nplurals=INTEGER; plural=EXPRESSION;' ) } self.fuzzy = False def __str__(self): output = self.generate() if not isinstance(output, str): output = output.encode(self.encoding) return output def __unicode__(self): output = self.generate() if not isinstance(output, unicode): output = unicode(output, self.encoding) return output def __repr__(self): return '<%s>' % self.__class__.__name__ def generate(self): """Generates the catalog header output.""" txt = u''.join([u'# %s\n' % x for x in self._comments]) + u'#\n' if self.fuzzy: txt += u'#, fuzzy\n' txt += u'msgid ""\nmsgstr""\n' for key, val in self._headers.values(): txt += u'"%s: %s\\n"\n' % (key, val) return txt def comments(self): """Get the comments the header has >>> ch = CatalogHeader() >>> ch.add_comment('Translation Template for Project XY') >>> ch.add_comment('Copyright FooBar 2010') >>> ch.comments() [u'Translation Template for Project XY', u'Copyright FooBar 2010'] """ return self._comments def headers(self): """Returns the headers. >>> ch = CatalogHeader() >>> ch.headers() #doctest: +SKIP [(u'Project-Id-Version', u'PROJECT VERSION'), (u'Report-Msgid-Bugs-To', u'ADDRESS@EMAIL'), (u'POT-Creation-Date', u'YEAR-MO-DA HO:MI+ZONE'), (u'PO-Revision-Date', u'YEAR-MO-DA HO:MI+ZONE'), (u'Last-Translator', u'FULL NAME <EMAIL@ADDRESS>'), (u'Language-Team', u'LANGUAGE <LL@li.org>'), (u'MIME-Version', u'1.0'), (u'Content-Type', u'text/plain; charset=UTF-8'), (u'Content-Transfer-Encoding', u'8bit'), (u'Plural-Forms', u'nplurals=INTEGER; plural=EXPRESSION;')] """ return self._headers.values() def add_comment(self, comment): """Add comments to the catalog header. >>> ch = CatalogHeader() >>> ch.add_comment('Translation Template for Project XY') >>> ch.add_comment('Copyright FooBar 2010') >>> print ch # Translation Template for Project XY # Copyright FooBar 2010 # msgid "" msgstr"" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: ADDRESS@EMAIL\n" "POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" <BLANKLINE> """ if comment not in self._comments: self._comments.append(unicode(comment)) def set_project_id_version(self, project, version): """Set the 'Project-Id-Version' header. >>> ch = CatalogHeader() >>> ch.set_project_id_version('Foo Project', 0.2) >>> print ch # msgid "" msgstr"" "Project-Id-Version: Foo Project 0.2\n" "Report-Msgid-Bugs-To: ADDRESS@EMAIL\n" "POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" <BLANKLINE> """ self._headers[ProjectIdVersion] = ( self._headers[ProjectIdVersion][0], u'%s %s' % (unicode(project), unicode(version)) ) def set_report_msgid_bugs_to(self, value): self._headers[ReportMsgidBugsTo] = ( self._headers[ReportMsgidBugsTo][0], unicode(value) ) def set_pot_creation_date(self, value): self._headers[POTCreationDate] = ( self._headers[POTCreationDate][0], unicode(value) ) def set_po_revision_date(self, value): self._headers[PORevisionDate] = ( self._headers[PORevisionDate][0], unicode(value) ) def set_last_translator(self, value): self._headers[LastTranslator] = ( self._headers[LastTranslator][0], unicode(value) ) def set_language_team(self, value): self._headers[LanguageTeam] = ( self._headers[LanguageTeam][0], unicode(value) ) def set_mime_version(self, value): self._headers[MIMEVersion] = ( self._headers[MIMEVersion][0], unicode(value) ) def set_content_type(self, ctype, charset): self._headers[ContentType] = ( self._headers[ContentType][0], u'%s; charset=%s' % (unicode(ctype), unicode(charset)) ) def set_content_transfer_encoding(self, value): self._headers[ContentTransferEncoding] = ( self._headers[ContentTransferEncoding][0], unicode(value) ) def set_plural_forms(self, nplurals, expression): self._headers[PluralForms] = ( self._headers[PluralForms][0], u'nplurals=%s; plural=%s;' % (unicode(nplurals), unicode(expression)) ) def set_custom_header(self, name, value): self._headers[len(self._headers)+1] = (unicode(name), unicode(value)) def set_fuzzy(self): self.fuzzy = True def unset_fuzzy(self): self.fuzzy = False
nosetests --with-doctest catalog.CatalogHeader ---------------------------------------------------------------------- Ran 0 tests in 0.008s OK
The problem seems to be on methods add_comment() and set_project_id_version().
Changelog
Tue Jan 2 12:36:40 2007: Modified by Pedro Algarvio, aka, s0undt3ch <ufs@ufsoft.org>
Tue Jan 2 12:39:31 2007: Modified by Pedro Algarvio, aka, s0undt3ch <ufs@ufsoft.org>
I'm using python 2.4.3 and apparently the SKIP directive is from python 2.5, but even if I remove that directive, I still get the same results.
Tue Jan 2 12:43:32 2007: Modified by Pedro Algarvio, aka, s0undt3ch <ufs@ufsoft.org>
Here's some debuging info:
nosetests -v -l nose --with-doctest I18NToolBox.lib.catalog nose.core: DEBUG: Adding /home/vampas/projects/i18n-toolbox/I18NToolBox/lib as nose working directory nose.core: INFO: Looking for tests in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.core: INFO: Working directory /home/vampas/projects/i18n-toolbox/I18NToolBox/lib is a package; adding to sys.path nose.importer: DEBUG: Add path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.importer: DEBUG: Add path /home/vampas/projects/i18n-toolbox/I18NToolBox nose.importer: DEBUG: Add path /home/vampas/projects/i18n-toolbox nose.result: DEBUG: start capture from <open file '<stdout>', mode 'w' at 0xb7c21068> nose.result: DEBUG: sys.stdout is now <cStringIO.StringO object at 0xb79c5e60> nose.loader: INFO: <nose.loader.TestLoader object at 0xb79c5eec> load tests in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib [None] nose.importer: DEBUG: Add path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.importer: DEBUG: Add path /home/vampas/projects/i18n-toolbox/I18NToolBox nose.importer: DEBUG: Add path /home/vampas/projects/i18n-toolbox nose.loader: DEBUG: candidate .svn in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/.svn resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/.svn, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/.svn is a directory nose.loader: DEBUG: candidate __init__.py in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/__init__.py resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/__init__.py, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/__init__.py is a file nose.selector: DEBUG: __init__.py matches ignoreFiles pattern; skipped nose.loader: DEBUG: candidate __init__.pyc in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/__init__.pyc resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/__init__.pyc, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/__init__.pyc is a file nose.selector: DEBUG: __init__.pyc matches ignoreFiles pattern; skipped nose.loader: DEBUG: candidate catalog.py in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py is a file nose.selector: DEBUG: Check file in tests nose.selector: DEBUG: tests to check: ['I18NToolBox.lib.catalog'] nose.selector: DEBUG: Filematch (None, I18NToolBox.lib.catalog, None, /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py) nose.selector: DEBUG: Is module path I18NToolBox/lib/catalog in file /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py? nose.selector: DEBUG: anytest matches: [None] nose.selector: DEBUG: anytest result: [None] nose.plugins: DEBUG: call plugin doctest: wantFile nose.loader: DEBUG: path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py is catalog.py in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.suite: DEBUG: running test test module catalog in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.suite: DEBUG: TestModule.setUp nose.importer: DEBUG: Import catalog from ['/home/vampas/projects/i18n-toolbox/I18NToolBox/lib'] (addpaths: True) nose.importer: DEBUG: Add path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.importer: DEBUG: Add path /home/vampas/projects/i18n-toolbox/I18NToolBox nose.importer: DEBUG: Add path /home/vampas/projects/i18n-toolbox nose.importer: DEBUG: find module part catalog (catalog) at ['/home/vampas/projects/i18n-toolbox/I18NToolBox/lib'] nose.importer: DEBUG: Loading catalog from /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py nose.importer: DEBUG: catalog from /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py yields <module 'catalog' from '/home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.pyc'> nose.suite: DEBUG: Imported <module 'catalog' from '/home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.pyc'> from catalog on /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: load from module <module 'catalog' from '/home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.pyc'> (/home/vampas/projects/i18n-toolbox/I18NToolBox/lib) nose.selector: DEBUG: tests to check: ['I18NToolBox.lib.catalog'] nose.selector: DEBUG: Checking module catalog in test I18NToolBox.lib.catalog:None (either: False) nose.selector: DEBUG: subpackage_of(catalog,I18NToolBox.lib.catalog) nose.selector: DEBUG: not catalog startswith I18NToolBox.lib.catalog nose.selector: DEBUG: Module catalog match I18NToolBox.lib.catalog (either: False) result False nose.selector: DEBUG: anytest matches: [False] nose.selector: DEBUG: anytest result: [] nose.selector: DEBUG: Module <module 'catalog' from '/home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.pyc'> in tests result: [] nose.loader: DEBUG: collect tests in catalog with plugin doctest nose.plugins.doctests: DEBUG: No doctests in <module 'catalog' from '/home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.pyc'> nose.loader: DEBUG: candidate catalog.py.bak in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py.bak resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py.bak, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py.bak is a file nose.selector: DEBUG: Check file in tests nose.selector: DEBUG: tests to check: ['I18NToolBox.lib.catalog'] nose.selector: DEBUG: Filematch (None, I18NToolBox.lib.catalog, None, /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py.bak) nose.selector: DEBUG: Is module path I18NToolBox/lib/catalog in file /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.py.bak? nose.selector: DEBUG: anytest matches: [None] nose.selector: DEBUG: anytest result: [None] nose.plugins: DEBUG: call plugin doctest: wantFile nose.loader: DEBUG: candidate catalog.pyc in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.pyc resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.pyc, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.pyc is a file nose.selector: DEBUG: Check file in tests nose.selector: DEBUG: tests to check: ['I18NToolBox.lib.catalog'] nose.selector: DEBUG: Filematch (None, I18NToolBox.lib.catalog, None, /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.pyc) nose.selector: DEBUG: Is module path I18NToolBox/lib/catalog in file /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/catalog.pyc? nose.selector: DEBUG: anytest matches: [None] nose.selector: DEBUG: anytest result: [None] nose.plugins: DEBUG: call plugin doctest: wantFile nose.loader: DEBUG: candidate genshi_gettext.py in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/genshi_gettext.py resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/genshi_gettext.py, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/genshi_gettext.py is a file nose.selector: DEBUG: Check file in tests nose.selector: DEBUG: tests to check: ['I18NToolBox.lib.catalog'] nose.selector: DEBUG: Filematch (None, I18NToolBox.lib.catalog, None, /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/genshi_gettext.py) nose.selector: DEBUG: Is module path I18NToolBox/lib/catalog in file /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/genshi_gettext.py? nose.selector: DEBUG: anytest matches: [False] nose.selector: DEBUG: anytest result: [] nose.loader: DEBUG: candidate genshi_gettext.pyc in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/genshi_gettext.pyc resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/genshi_gettext.pyc, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/genshi_gettext.pyc is a file nose.selector: DEBUG: Check file in tests nose.selector: DEBUG: tests to check: ['I18NToolBox.lib.catalog'] nose.selector: DEBUG: Filematch (None, I18NToolBox.lib.catalog, None, /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/genshi_gettext.pyc) nose.selector: DEBUG: Is module path I18NToolBox/lib/catalog in file /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/genshi_gettext.pyc? nose.selector: DEBUG: anytest matches: [False] nose.selector: DEBUG: anytest result: [] nose.loader: DEBUG: candidate gettext_tables.py in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/gettext_tables.py resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/gettext_tables.py, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/gettext_tables.py is a file nose.selector: DEBUG: Check file in tests nose.selector: DEBUG: tests to check: ['I18NToolBox.lib.catalog'] nose.selector: DEBUG: Filematch (None, I18NToolBox.lib.catalog, None, /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/gettext_tables.py) nose.selector: DEBUG: Is module path I18NToolBox/lib/catalog in file /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/gettext_tables.py? nose.selector: DEBUG: anytest matches: [False] nose.selector: DEBUG: anytest result: [] nose.loader: DEBUG: candidate gettext_tables.pyc in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/gettext_tables.pyc resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/gettext_tables.pyc, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/gettext_tables.pyc is a file nose.selector: DEBUG: Check file in tests nose.selector: DEBUG: tests to check: ['I18NToolBox.lib.catalog'] nose.selector: DEBUG: Filematch (None, I18NToolBox.lib.catalog, None, /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/gettext_tables.pyc) nose.selector: DEBUG: Is module path I18NToolBox/lib/catalog in file /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/gettext_tables.pyc? nose.selector: DEBUG: anytest matches: [False] nose.selector: DEBUG: anytest result: [] nose.loader: DEBUG: candidate utils.py in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/utils.py resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/utils.py, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/utils.py is a file nose.selector: DEBUG: Check file in tests nose.selector: DEBUG: tests to check: ['I18NToolBox.lib.catalog'] nose.selector: DEBUG: Filematch (None, I18NToolBox.lib.catalog, None, /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/utils.py) nose.selector: DEBUG: Is module path I18NToolBox/lib/catalog in file /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/utils.py? nose.selector: DEBUG: anytest matches: [False] nose.selector: DEBUG: anytest result: [] nose.loader: DEBUG: candidate utils.pyc in /home/vampas/projects/i18n-toolbox/I18NToolBox/lib nose.loader: DEBUG: test name /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/utils.pyc resolves to path /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/utils.pyc, module None, callable None nose.loader: DEBUG: /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/utils.pyc is a file nose.selector: DEBUG: Check file in tests nose.selector: DEBUG: tests to check: ['I18NToolBox.lib.catalog'] nose.selector: DEBUG: Filematch (None, I18NToolBox.lib.catalog, None, /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/utils.pyc) nose.selector: DEBUG: Is module path I18NToolBox/lib/catalog in file /home/vampas/projects/i18n-toolbox/I18NToolBox/lib/utils.pyc? nose.selector: DEBUG: anytest matches: [False] nose.selector: DEBUG: anytest result: [] nose.result: DEBUG: printErrors called nose.result: DEBUG: calling plugin reports ---------------------------------------------------------------------- Ran 0 tests in 0.335s OK nose.result: DEBUG: capture ended, sys.stdout is now <open file '<stdout>', mode 'w' at 0xb7c21068>
Wed Jan 3 09:56:27 2007: Modified by Pedro Algarvio, aka, s0undt3ch <ufs@ufsoft.org>
In order to work those docstrings have to become:
def add_comment(self, comment):
"""Add comments to the catalog header.
>>> ch = CatalogHeader()
>>> ch.add_comment('Translation Template for Project XY')
>>> ch.add_comment('Copyright FooBar 2010')
>>> print ch
# Translation Template for Project XY
# Copyright FooBar 2010
#
msgid ""
msgstr""
"Project-Id-Version: PROJECT VERSION\\n"
"Report-Msgid-Bugs-To: ADDRESS@EMAIL\\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
"Language-Team: LANGUAGE <LL@li.org>\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n"
<BLANKLINE>
"""
if comment not in self._comments:
self._comments.append(unicode(comment))
def set_project_id_version(self, project, version):
"""Set the 'Project-Id-Version' header.
>>> ch = CatalogHeader()
>>> ch.set_project_id_version('Foo Project', 0.2)
>>> print ch
#
msgid ""
msgstr""
"Project-Id-Version: Foo Project 0.2\\n"
"Report-Msgid-Bugs-To: ADDRESS@EMAIL\\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
"Language-Team: LANGUAGE <LL@li.org>\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
<BLANKLINE>
"""
self._headers[ProjectIdVersion] = (
self._headers[ProjectIdVersion][0],
u'%s %s' % (unicode(project), unicode(version))
)

Here's some debuging info: