mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-129911: pygettext: Fix the keyword entry in help output (GH-129914)
This commit is contained in:
parent
3bd3e09588
commit
9d1e668e6f
3 changed files with 10 additions and 2 deletions
|
@ -413,6 +413,12 @@ class Test_pygettext(unittest.TestCase):
|
||||||
self.assertIn(f'msgid "{text2}"', data)
|
self.assertIn(f'msgid "{text2}"', data)
|
||||||
self.assertNotIn(text3, data)
|
self.assertNotIn(text3, data)
|
||||||
|
|
||||||
|
def test_help_text(self):
|
||||||
|
"""Test that the help text is displayed."""
|
||||||
|
res = assert_python_ok(self.script, '--help')
|
||||||
|
self.assertEqual(res.out, b'')
|
||||||
|
self.assertIn(b'pygettext -- Python equivalent of xgettext(1)', res.err)
|
||||||
|
|
||||||
def test_error_messages(self):
|
def test_error_messages(self):
|
||||||
"""Test that pygettext outputs error messages to stderr."""
|
"""Test that pygettext outputs error messages to stderr."""
|
||||||
stderr = self.get_stderr(dedent('''\
|
stderr = self.get_stderr(dedent('''\
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fix the keyword entry in the help output of :program:`pygettext`.
|
|
@ -67,7 +67,8 @@ Options:
|
||||||
-k word
|
-k word
|
||||||
--keyword=word
|
--keyword=word
|
||||||
Keywords to look for in addition to the default set, which are:
|
Keywords to look for in addition to the default set, which are:
|
||||||
%(DEFAULTKEYWORDS)s
|
_, gettext, ngettext, pgettext, npgettext, dgettext, dngettext,
|
||||||
|
dpgettext, and dnpgettext.
|
||||||
|
|
||||||
You can have multiple -k flags on the command line.
|
You can have multiple -k flags on the command line.
|
||||||
|
|
||||||
|
@ -169,7 +170,7 @@ msgstr ""
|
||||||
|
|
||||||
|
|
||||||
def usage(code, msg=''):
|
def usage(code, msg=''):
|
||||||
print(__doc__ % globals(), file=sys.stderr)
|
print(__doc__, file=sys.stderr)
|
||||||
if msg:
|
if msg:
|
||||||
print(msg, file=sys.stderr)
|
print(msg, file=sys.stderr)
|
||||||
sys.exit(code)
|
sys.exit(code)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue