Skip to content

Commit c9dfd5c

Browse files
committed
Add more comments tests for keyword spec
1 parent 527a9a1 commit c9dfd5c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/comments_test.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from redgettext import Options
44
from tests.utils import FILENAME, get_extractor, get_test_potfile
55

6-
OPTIONS = Options()
6+
OPTIONS = Options(keyword_specs=("_:1", 'ngettext:1,2,"comment from keyword spec"'))
77
SOURCE = """\
88
# Translators: comment A1
99
_('A') + _('B')
@@ -41,6 +41,12 @@
4141
# as long as there's no code between
4242
4343
_('D')
44+
45+
# Translators: handles comments from keyspec too
46+
# no matter if there's a translator comment in code or not
47+
ngettext('E', 'F', 2)
48+
49+
ngettext('G', 'H', 2)
4450
"""
4551

4652

@@ -86,6 +92,22 @@ def test_comments() -> None:
8692
"as long as there's no code between"
8793
),
8894
),
95+
polib.POEntry(
96+
msgid="E",
97+
msgid_plural="F",
98+
occurrences=[(FILENAME, 40)],
99+
comment=(
100+
"Translators: handles comments from keyspec too\n"
101+
"no matter if there's a translator comment in code or not\n"
102+
"comment from keyword spec"
103+
),
104+
),
105+
polib.POEntry(
106+
msgid="G",
107+
msgid_plural="H",
108+
occurrences=[(FILENAME, 42)],
109+
comment="comment from keyword spec",
110+
),
89111
)
90112
assert str(extractor.potfile_manager.current_potfile) == str(expected)
91113
assert extractor.potfile_manager.current_potfile == expected

0 commit comments

Comments
 (0)