Skip to content

Commit

Permalink
Add a roundtrip test
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasr8 committed Oct 19, 2024
1 parent 835ba63 commit efea1fe
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/messages/test_pofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,31 @@ def test_obsolete_messages_with_context(self):
assert orange_msg.string == 'Bar'
assert orange_msg.user_comments == ['This is an obsolete message with the same id but different context']

def test_obsolete_messages_roundtrip(self):
buf = StringIO('''\
# This message is not obsolete
#: main.py:1
msgid "bar"
msgstr "Bahr"
# This is an obsolete message
#~ msgid "foo"
#~ msgstr "Voh"
# This is an obsolete message
#~ msgctxt "apple"
#~ msgid "foo"
#~ msgstr "Foo"
# This is an obsolete message with the same id but different context
#~ msgctxt "orange"
#~ msgid "foo"
#~ msgstr "Bar"
''')
generated_po_file = ''.join(pofile.generate_po(pofile.read_po(buf), omit_header=True))
assert buf.getvalue() == generated_po_file

def test_multiline_context(self):
buf = StringIO('''
msgctxt "a really long "
Expand Down

0 comments on commit efea1fe

Please sign in to comment.