summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Morega <alex@grep.ro>2013-07-07 11:58:04 +0200
committerAlex Morega <alex@grep.ro>2013-07-07 11:58:04 +0200
commit4a6656ad836182e61bf90638637f2fad9de58312 (patch)
tree0d963fb9aab90cd1422ccd67caaa32b500bbdfb6 /tests
parentbd743feefa4e1b14f0ba7ade45edd86a6c7e3a00 (diff)
downloadbabel-4a6656ad836182e61bf90638637f2fad9de58312.tar.gz
fix tests for babel.messages.checkers
Diffstat (limited to 'tests')
-rw-r--r--tests/messages/test_checkers.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/messages/test_checkers.py b/tests/messages/test_checkers.py
index 218b442..b954acb 100644
--- a/tests/messages/test_checkers.py
+++ b/tests/messages/test_checkers.py
@@ -22,7 +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
+from babel._compat import BytesIO
class CheckersTestCase(unittest.TestCase):
@@ -79,7 +79,7 @@ msgstr[0] ""
# This test will fail for revisions <= 406 because so far
# catalog.num_plurals was neglected
- catalog = read_po(StringIO(po_file), _locale)
+ catalog = read_po(BytesIO(po_file), _locale)
message = catalog['foobar']
checkers.num_plurals(catalog, message)
@@ -147,13 +147,13 @@ msgstr[2] ""
# This test will fail for revisions <= 406 because so far
# catalog.num_plurals was neglected
- catalog = read_po(StringIO(po_file), _locale)
+ catalog = read_po(BytesIO(po_file), _locale)
message = catalog['foobar']
checkers.num_plurals(catalog, message)
def test_3_num_plurals_checkers(self):
for _locale in [p for p in PLURALS if PLURALS[p][0] == 3]:
- po_file = r"""\
+ po_file = (r"""\
# %(english_name)s translations for TestProject.
# Copyright (C) 2007 FooBar, Inc.
# This file is distributed under the same license as the TestProject
@@ -194,17 +194,17 @@ msgstr[1] ""
'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale=_locale),
num_plurals = PLURALS[_locale][0],
- plural_expr = PLURALS[_locale][0])
+ plural_expr = PLURALS[_locale][0])).encode('utf-8')
# This test will fail for revisions <= 406 because so far
# catalog.num_plurals was neglected
- catalog = read_po(StringIO(po_file), _locale)
+ catalog = read_po(BytesIO(po_file), _locale)
message = catalog['foobar']
checkers.num_plurals(catalog, message)
def test_4_num_plurals_checkers(self):
for _locale in [p for p in PLURALS if PLURALS[p][0] == 4]:
- po_file = r"""\
+ po_file = (r"""\
# %(english_name)s translations for TestProject.
# Copyright (C) 2007 FooBar, Inc.
# This file is distributed under the same license as the TestProject
@@ -246,17 +246,17 @@ msgstr[2] ""
'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale=_locale),
num_plurals = PLURALS[_locale][0],
- plural_expr = PLURALS[_locale][0])
+ plural_expr = PLURALS[_locale][0])).encode('utf-8')
# This test will fail for revisions <= 406 because so far
# catalog.num_plurals was neglected
- catalog = read_po(StringIO(po_file), _locale)
+ catalog = read_po(BytesIO(po_file), _locale)
message = catalog['foobar']
checkers.num_plurals(catalog, message)
def test_5_num_plurals_checkers(self):
for _locale in [p for p in PLURALS if PLURALS[p][0] == 5]:
- po_file = r"""\
+ po_file = (r"""\
# %(english_name)s translations for TestProject.
# Copyright (C) 2007 FooBar, Inc.
# This file is distributed under the same license as the TestProject
@@ -299,17 +299,17 @@ msgstr[3] ""
'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale=_locale),
num_plurals = PLURALS[_locale][0],
- plural_expr = PLURALS[_locale][0])
+ plural_expr = PLURALS[_locale][0])).encode('utf-8')
# This test will fail for revisions <= 406 because so far
# catalog.num_plurals was neglected
- catalog = read_po(StringIO(po_file), _locale)
+ catalog = read_po(BytesIO(po_file), _locale)
message = catalog['foobar']
checkers.num_plurals(catalog, message)
def test_6_num_plurals_checkers(self):
for _locale in [p for p in PLURALS if PLURALS[p][0] == 6]:
- po_file = r"""\
+ po_file = (r"""\
# %(english_name)s translations for TestProject.
# Copyright (C) 2007 FooBar, Inc.
# This file is distributed under the same license as the TestProject
@@ -353,10 +353,10 @@ msgstr[4] ""
'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale=_locale),
num_plurals = PLURALS[_locale][0],
- plural_expr = PLURALS[_locale][0])
+ plural_expr = PLURALS[_locale][0])).encode('utf-8')
# This test will fail for revisions <= 406 because so far
# catalog.num_plurals was neglected
- catalog = read_po(StringIO(po_file), _locale)
+ catalog = read_po(BytesIO(po_file), _locale)
message = catalog['foobar']
checkers.num_plurals(catalog, message)