summaryrefslogtreecommitdiff
path: root/tests/messages/test_mofile.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/messages/test_mofile.py')
-rw-r--r--tests/messages/test_mofile.py28
1 files changed, 11 insertions, 17 deletions
diff --git a/tests/messages/test_mofile.py b/tests/messages/test_mofile.py
index bf6ef5e..6e026a8 100644
--- a/tests/messages/test_mofile.py
+++ b/tests/messages/test_mofile.py
@@ -28,12 +28,11 @@ class ReadMoTestCase(unittest.TestCase):
'LC_MESSAGES', 'messages.mo')
with open(mo_path, 'rb') as mo_file:
catalog = mofile.read_mo(mo_file)
- self.assertEqual(2, len(catalog))
- self.assertEqual('TestProject', catalog.project)
- self.assertEqual('0.1', catalog.version)
- self.assertEqual('Stange', catalog['bar'].string)
- self.assertEqual(['Fuhstange', 'Fuhstangen'],
- catalog['foobar'].string)
+ assert len(catalog) == 2
+ assert catalog.project == 'TestProject'
+ assert catalog.version == '0.1'
+ assert catalog['bar'].string == 'Stange'
+ assert catalog['foobar'].string == ['Fuhstange', 'Fuhstangen']
class WriteMoTestCase(unittest.TestCase):
@@ -54,16 +53,11 @@ class WriteMoTestCase(unittest.TestCase):
mofile.write_mo(buf, catalog)
buf.seek(0)
translations = Translations(fp=buf)
- self.assertEqual(u'Voh', translations.ugettext('foo'))
- assert isinstance(translations.ugettext('foo'), str)
- self.assertEqual(u'Es gibt', translations.ungettext('There is', 'There are', 1))
- assert isinstance(translations.ungettext('There is', 'There are', 1), str)
- self.assertEqual(u'Fizz', translations.ugettext('Fizz'))
- assert isinstance(translations.ugettext('Fizz'), str)
- self.assertEqual(u'Fuzz', translations.ugettext('Fuzz'))
- assert isinstance(translations.ugettext('Fuzz'), str)
- self.assertEqual(u'Fuzzes', translations.ugettext('Fuzzes'))
- assert isinstance(translations.ugettext('Fuzzes'), str)
+ assert translations.ugettext('foo') == 'Voh'
+ assert translations.ungettext('There is', 'There are', 1) == 'Es gibt'
+ assert translations.ugettext('Fizz') == 'Fizz'
+ assert translations.ugettext('Fuzz') == 'Fuzz'
+ assert translations.ugettext('Fuzzes') == 'Fuzzes'
def test_more_plural_forms(self):
catalog2 = Catalog(locale='ru_RU')
@@ -92,4 +86,4 @@ class WriteMoTestCase(unittest.TestCase):
translations = Translations(fp=buf1)
translations.add_fallback(Translations(fp=buf2))
- self.assertEqual(u'Flou', translations.ugettext('Fuzz'))
+ assert translations.ugettext('Fuzz') == 'Flou'