Skip to content
Merged
Prev Previous commit
Next Next commit
Update test_optparse.py
  • Loading branch information
ShaharNaveh committed Aug 23, 2025
commit 713cb7043e200be596f03af65e8bdedb1a030cfc
15 changes: 12 additions & 3 deletions Lib/test/test_optparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from io import StringIO
from test import support
from test.support import os_helper

from test.support.i18n_helper import TestTranslationsBase, update_translation_snapshots

import optparse
from optparse import make_option, Option, \
Expand Down Expand Up @@ -614,9 +614,9 @@ def test_float_default(self):
self.parser.add_option(
"-p", "--prob",
help="blow up with probability PROB [default: %default]")
self.parser.set_defaults(prob=0.43)
self.parser.set_defaults(prob=0.25)
expected_help = self.help_prefix + \
" -p PROB, --prob=PROB blow up with probability PROB [default: 0.43]\n"
" -p PROB, --prob=PROB blow up with probability PROB [default: 0.25]\n"
self.assertHelp(self.parser, expected_help)

def test_alt_expand(self):
Expand Down Expand Up @@ -1656,5 +1656,14 @@ def test__all__(self):
support.check__all__(self, optparse, not_exported=not_exported)


class TestTranslations(TestTranslationsBase):
def test_translations(self):
self.assertMsgidsEqual(optparse)


if __name__ == '__main__':
# To regenerate translation snapshots
if len(sys.argv) > 1 and sys.argv[1] == '--snapshot-update':
update_translation_snapshots(optparse)
sys.exit(0)
unittest.main()