diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2013-07-06 16:57:29 +0200 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2013-07-06 16:57:29 +0200 |
commit | 7ec1963d292bdbcc3c43e2684134ae4670833e61 (patch) | |
tree | d249c87dc6eb0b48519594a53b3e2ec25f32338c /tests | |
parent | 28c74232f2ff0a50e6932c0e207b6f3f2ac33121 (diff) | |
download | babel-7ec1963d292bdbcc3c43e2684134ae4670833e61.tar.gz |
Resolved a bunch of syntax errors
Diffstat (limited to 'tests')
-rw-r--r-- | tests/messages/test_checkers.py | 26 | ||||
-rw-r--r-- | tests/messages/test_extract.py | 24 | ||||
-rw-r--r-- | tests/messages/test_frontend.py | 2 | ||||
-rw-r--r-- | tests/messages/test_mofile.py | 3 | ||||
-rw-r--r-- | tests/messages/test_pofile.py | 3 |
5 files changed, 28 insertions, 30 deletions
diff --git a/tests/messages/test_checkers.py b/tests/messages/test_checkers.py index 4eb4cc9..218b442 100644 --- a/tests/messages/test_checkers.py +++ b/tests/messages/test_checkers.py @@ -14,7 +14,6 @@ from datetime import datetime import time import unittest -from StringIO import StringIO from babel import __version__ as VERSION from babel.core import Locale, UnknownLocaleError @@ -23,6 +22,7 @@ from babel.messages import checkers from babel.messages.plurals import PLURALS from babel.messages.pofile import read_po from babel.util import LOCALTZ +from babel._compat import StringIO class CheckersTestCase(unittest.TestCase): @@ -102,7 +102,7 @@ msgstr[0] "" except UnknownLocaleError: # Just an alias? Not what we're testing here, let's continue continue - po_file = (ur"""\ + po_file = (u"""\ # %(english_name)s translations for TestProject. # Copyright (C) 2007 FooBar, Inc. # This file is distributed under the same license as the TestProject @@ -111,17 +111,17 @@ msgstr[0] "" # msgid "" msgstr "" -"Project-Id-Version: TestProject 0.1\n" -"Report-Msgid-Bugs-To: bugs.address@email.tld\n" -"POT-Creation-Date: 2007-04-01 15:30+0200\n" -"PO-Revision-Date: %(date)s\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: %(locale)s <LL@li.org>\n" -"Plural-Forms: nplurals=%(num_plurals)s; plural=%(plural_expr)s\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel %(version)s\n" +"Project-Id-Version: TestProject 0.1\\n" +"Report-Msgid-Bugs-To: bugs.address@email.tld\\n" +"POT-Creation-Date: 2007-04-01 15:30+0200\\n" +"PO-Revision-Date: %(date)s\\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n" +"Language-Team: %(locale)s <LL@li.org>\\n" +"Plural-Forms: nplurals=%(num_plurals)s; plural=%(plural_expr)s\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=utf-8\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Generated-By: Babel %(version)s\\n" #. This will be a translator comment, #. that will include several lines diff --git a/tests/messages/test_extract.py b/tests/messages/test_extract.py index 569b483..7e587f9 100644 --- a/tests/messages/test_extract.py +++ b/tests/messages/test_extract.py @@ -316,38 +316,38 @@ n = ngettext('foo') self.assertEqual(('foo'), messages[5][2]) def test_utf8_message(self): - buf = BytesIO(b""" + buf = BytesIO(u""" # NOTE: hello msg = _('Bonjour à tous') -""") +""".encode('utf-8')) messages = list(extract.extract_python(buf, ('_',), ['NOTE:'], {'encoding': 'utf-8'})) self.assertEqual(u'Bonjour à tous', messages[0][2]) self.assertEqual([u'NOTE: hello'], messages[0][3]) def test_utf8_message_with_magic_comment(self): - buf = BytesIO(b"""# -*- coding: utf-8 -*- + buf = BytesIO(u"""# -*- coding: utf-8 -*- # NOTE: hello msg = _('Bonjour à tous') -""") +""".encode('utf-8')) messages = list(extract.extract_python(buf, ('_',), ['NOTE:'], {})) self.assertEqual(u'Bonjour à tous', messages[0][2]) self.assertEqual([u'NOTE: hello'], messages[0][3]) def test_utf8_message_with_utf8_bom(self): - buf = StringIO(codecs.BOM_UTF8 + """ + buf = StringIO(codecs.BOM_UTF8 + u""" # NOTE: hello msg = _('Bonjour à tous') -""") +""".encode('utf-8')) messages = list(extract.extract_python(buf, ('_',), ['NOTE:'], {})) self.assertEqual(u'Bonjour à tous', messages[0][2]) self.assertEqual([u'NOTE: hello'], messages[0][3]) def test_utf8_raw_strings_match_unicode_strings(self): - buf = StringIO(codecs.BOM_UTF8 + """ + buf = StringIO(codecs.BOM_UTF8 + u""" msg = _('Bonjour à tous') msgu = _(u'Bonjour à tous') -""") +""".encode('utf-8')) messages = list(extract.extract_python(buf, ('_',), ['NOTE:'], {})) self.assertEqual(u'Bonjour à tous', messages[0][2]) self.assertEqual(messages[0][2], messages[1][2]) @@ -408,21 +408,21 @@ msg10 = dngettext(domain, 'Page', 'Pages', 3) (10, (u'Page', u'Pages'), [], None)], messages) def test_message_with_line_comment(self): - buf = BytesIO(b"""\ + buf = BytesIO(u"""\ // NOTE: hello msg = _('Bonjour à tous') -""") +""".encode('utf-8')) messages = list(extract.extract_javascript(buf, ('_',), ['NOTE:'], {})) self.assertEqual(u'Bonjour à tous', messages[0][2]) self.assertEqual([u'NOTE: hello'], messages[0][3]) def test_message_with_multiline_comment(self): - buf = BytesIO(b"""\ + buf = BytesIO(u"""\ /* NOTE: hello and bonjour and servus */ msg = _('Bonjour à tous') -""") +""".encode('utf-8')) messages = list(extract.extract_javascript(buf, ('_',), ['NOTE:'], {})) self.assertEqual(u'Bonjour à tous', messages[0][2]) self.assertEqual([u'NOTE: hello', 'and bonjour', ' and servus'], messages[0][3]) diff --git a/tests/messages/test_frontend.py b/tests/messages/test_frontend.py index 9cce4b7..7f76342 100644 --- a/tests/messages/test_frontend.py +++ b/tests/messages/test_frontend.py @@ -18,7 +18,6 @@ from distutils.log import _global_log import logging import os import shutil -from StringIO import StringIO import sys import time import unittest @@ -28,6 +27,7 @@ from babel.dates import format_datetime from babel.messages import frontend from babel.util import LOCALTZ from babel.messages.pofile import read_po +from babel._compat import StringIO this_dir = os.path.abspath(os.path.dirname(__file__)) diff --git a/tests/messages/test_mofile.py b/tests/messages/test_mofile.py index 6d15d0d..835891d 100644 --- a/tests/messages/test_mofile.py +++ b/tests/messages/test_mofile.py @@ -11,13 +11,12 @@ # individuals. For the exact contribution history, see the revision # history and logs, available at http://babel.edgewall.org/log/. -import doctest import gettext import os import unittest -from StringIO import StringIO from babel.messages import mofile, Catalog +from babel._compat import StringIO class ReadMoTestCase(unittest.TestCase): diff --git a/tests/messages/test_pofile.py b/tests/messages/test_pofile.py index 68e3d22..393785f 100644 --- a/tests/messages/test_pofile.py +++ b/tests/messages/test_pofile.py @@ -12,14 +12,13 @@ # history and logs, available at http://babel.edgewall.org/log/. from datetime import datetime -import doctest -from StringIO import StringIO import unittest from babel.core import Locale from babel.messages.catalog import Catalog, Message from babel.messages import pofile from babel.util import FixedOffsetTimezone +from babel._compat import StringIO class ReadPoTestCase(unittest.TestCase): |