Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lib/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ def __init__(
self._whitespace_matcher = _re.compile(r'\s+', _re.ASCII)
self._long_break_matcher = _re.compile(r'\n\n\n+')

self._set_color(False)

def _set_color(self, color):
from _colorize import can_colorize, decolor, get_theme

Expand Down
5 changes: 5 additions & 0 deletions Lib/test/test_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5694,6 +5694,11 @@ def custom_formatter(prog):
a-very-long-command command that does something
'''))

def test_direct_formatter_instantiation(self):
formatter = argparse.HelpFormatter(prog="program")
formatter.add_usage(usage=None, actions=[], groups=[])
help_text = formatter.format_help()
self.assertEqual(help_text, "usage: program\n")

# =====================================
# Optional/Positional constructor tests
Expand Down
Loading