Skip to content

Commit 888cdd0

Browse files
committed
Add tests for using msgcat with plural message forms
1 parent 2dababc commit 888cdd0

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

tests/messages/test_frontend.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ def setUp(self):
735735
catalog.add('other2', string='Other 2', locations=[('simple.py', 10)])
736736
catalog.add('same', string='Same', locations=[('simple.py', 100)], flags=['flag1', 'flag1.2'])
737737
catalog.add('almost_same', string='Almost same', locations=[('simple.py', 1000)], flags=['flag2'])
738+
catalog.add(('plural', 'plurals'), string=('Plural', 'Plurals'), locations=[('simple.py', 2000)])
738739
pofile.write_po(file, catalog)
739740

740741
with open(self.temp2, 'wb') as file:
@@ -743,6 +744,7 @@ def setUp(self):
743744
catalog.add('other4', string='Other 4', locations=[('hard.py', 10)])
744745
catalog.add('almost_same', string='A bit same', locations=[('hard.py', 1000)], flags=['flag3'])
745746
catalog.add('same', string='Same', locations=[('hard.py', 100)], flags=['flag4'])
747+
catalog.add(('plural', 'plurals'), string=('Plural', 'Plurals other'), locations=[('hard.py', 2000)])
746748
pofile.write_po(file, catalog)
747749

748750
def tearDown(self):
@@ -757,7 +759,6 @@ def _get_expected(self, messages):
757759
# This file is distributed under the same license as the PROJECT project.
758760
# FIRST AUTHOR <EMAIL@ADDRESS>, 1994.
759761
#
760-
#, fuzzy
761762
msgid ""
762763
msgstr ""
763764
"Project-Id-Version: PROJECT VERSION\n"
@@ -809,6 +810,12 @@ def test_default(self):
809810
msgid "almost_same"
810811
msgstr "Almost same"
811812
813+
#: hard.py:2000 simple.py:2000
814+
msgid "plural"
815+
msgid_plural "plurals"
816+
msgstr[0] "Plural"
817+
msgstr[1] "Plurals"
818+
812819
#: hard.py:1
813820
msgid "other3"
814821
msgstr "Other 3"
@@ -882,6 +889,12 @@ def test_more_than(self):
882889
msgid "almost_same"
883890
msgstr "Almost same"
884891
892+
#: hard.py:2000 simple.py:2000
893+
msgid "plural"
894+
msgid_plural "plurals"
895+
msgstr[0] "Plural"
896+
msgstr[1] "Plurals"
897+
885898
""")
886899

887900
with open(self.output_file, 'r') as f:

0 commit comments

Comments
 (0)