]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Fixed tests that failed because of whitespace normalization
authorArmin Ronacher <armin.ronacher@active-4.com>
Fri, 5 Jul 2013 10:50:53 +0000 (12:50 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Fri, 5 Jul 2013 10:50:53 +0000 (12:50 +0200)
babel/messages/catalog.py
babel/messages/pofile.py
babel/messages/tests/frontend.py
babel/messages/tests/pofile.py

index abf96a1efb0e4d2651e173a3b58d69e51efadb01..de991fa2092d4846448ddfcfe8def6e752bb3db8 100644 (file)
@@ -615,7 +615,7 @@ class Catalog(object):
                     decoded_headers[name] = value
                 return decoded_headers
             self.mime_headers = _parse_header(message.string).items()
-            self.header_comment = '\n'.join(['# %s' % comment for comment
+            self.header_comment = '\n'.join([('# %s' % c).rstrip() for c
                                              in message.user_comments])
             self.fuzzy = message.fuzzy
         else:
index da904954b1567e33f4fdbee5c9849068500950e7..3afbaa39cf0b8a5767feb332c1523d3c9217f30a 100644 (file)
@@ -18,7 +18,6 @@ format.
        <http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files>`_
 """
 
-from datetime import datetime
 import os
 import re
 
@@ -88,6 +87,7 @@ def read_po(fileobj, locale=None, domain=None, ignore_obsolete=False):
     """Read messages from a ``gettext`` PO (portable object) file from the given
     file-like object and return a `Catalog`.
 
+    >>> from datetime import datetime
     >>> from StringIO import StringIO
     >>> buf = StringIO('''
     ... #: main.py:1
index 2a9349a14e4642a30273021a8b3a9ec7adc88b6e..2d934e7edacd594a33e6d80190ba669d3d5ae685 100644 (file)
@@ -86,7 +86,7 @@ class ExtractMessagesTestCase(unittest.TestCase):
 
         os.chdir(self.olddir)
 
-    def  _i18n_dir(self):
+    def _i18n_dir(self):
         return os.path.join(self.datadir, 'project', 'i18n')
 
     def _pot_file(self):
@@ -546,8 +546,7 @@ msgstr[0] ""
 
         po_file = self._po_file('en_US')
         assert os.path.isfile(po_file)
-        self.assertEqual(
-r"""# English (United States) translations for TestProject.
+        self.assertEqual(r"""# English (United States) translations for TestProject.
 # Copyright (C) 2007 FooBar, Inc.
 # This file is distributed under the same license as the TestProject
 # project.
index 9d1d437f65f57bf01c1bcf86e03ac709906d9d9d..f8a3d570c670e4a3830d5904180525fc24ed8141 100644 (file)
@@ -302,7 +302,7 @@ not be removed
         pofile.write_po(buf, catalog, no_location=True, omit_header=True,
                          width=42)
         self.assertEqual(r'''msgid ""
-"Here's some text where       \n"
+"Here's some text where\n"
 "white space and line breaks matter, and"
 " should\n"
 "\n"