summaryrefslogtreecommitdiff
path: root/tests/messages/test_mofile.py
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2022-05-10 11:52:35 +0300
committerAarni Koskela <akx@iki.fi>2022-05-10 15:37:41 +0300
commitd06dcbf2a0cc34c3172fd175cfb3c43684cfd37c (patch)
treeee572fea0246ecf882d5c569fc9a73d043d6dc8c /tests/messages/test_mofile.py
parentd0ec73dcfb153823a12f8f94871849b6cd9fece9 (diff)
downloadbabel-d06dcbf2a0cc34c3172fd175cfb3c43684cfd37c.tar.gz
tests: Use regular asserts instead of unittest functions
Automated conversion initially applied with https://github.com/warlo/codemod-unittest-to-pytest-asserts, followed by some manual changes for brevity.
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'