Skip to content

Commit

Permalink
Add more comments tests for keyword spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen committed Sep 3, 2022
1 parent 527a9a1 commit c9dfd5c
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/comments_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from redgettext import Options
from tests.utils import FILENAME, get_extractor, get_test_potfile

OPTIONS = Options()
OPTIONS = Options(keyword_specs=("_:1", 'ngettext:1,2,"comment from keyword spec"'))
SOURCE = """\
# Translators: comment A1
_('A') + _('B')
Expand Down Expand Up @@ -41,6 +41,12 @@
# as long as there's no code between
_('D')
# Translators: handles comments from keyspec too
# no matter if there's a translator comment in code or not
ngettext('E', 'F', 2)
ngettext('G', 'H', 2)
"""


Expand Down Expand Up @@ -86,6 +92,22 @@ def test_comments() -> None:
"as long as there's no code between"
),
),
polib.POEntry(
msgid="E",
msgid_plural="F",
occurrences=[(FILENAME, 40)],
comment=(
"Translators: handles comments from keyspec too\n"
"no matter if there's a translator comment in code or not\n"
"comment from keyword spec"
),
),
polib.POEntry(
msgid="G",
msgid_plural="H",
occurrences=[(FILENAME, 42)],
comment="comment from keyword spec",
),
)
assert str(extractor.potfile_manager.current_potfile) == str(expected)
assert extractor.potfile_manager.current_potfile == expected

0 comments on commit c9dfd5c

Please sign in to comment.