Skip to content

Commit

Permalink
Merge pull request #91 from transifex/test-po-duplicated-entries
Browse files Browse the repository at this point in the history
Add tests about duplicated PO entries
  • Loading branch information
rigaspapas committed Mar 21, 2018
2 parents e0e86c1 + fd75df9 commit 77da560
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions openformats/tests/formats/po/test_po.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,35 @@ def test_not_source_removes_untranslated_on_upload(self):
}))
)

def test_duplicated_text_is_not_confused(self):
string1 = self._create_openstring(False)
source = strip_leading_spaces(u"""
msgctxt ""
msgid "{s1_key}"
msgstr "{s1_key}"
msgctxt "t2"
msgid "{s1_key}"
msgstr "{s1_key}"
""".format(**{
"s1_key": string1.key,
}))
template, stringset = self.handler.parse(source)
compiled = self.handler.compile(template, [string1])
self.assertEquals(
compiled,
strip_leading_spaces(u"""# \nmsgid ""
msgstr ""
msgctxt ""
msgid "{s1_key}"
msgstr "{s1_str}"
""".format(**{
"s1_key": string1.key,
"s1_str": string1.string
}))
)

def test_fuzzy_flag_removes_entry_but_keeps_strings(self):
string1 = self._create_openstring(False)
string2 = self._create_openstring(False, extra_context={'fuzzy': True})
Expand Down

0 comments on commit 77da560

Please sign in to comment.