mirror of
https://github.com/django/django.git
synced 2025-10-07 01:00:47 +00:00
[4.1.x] Fixed #33657 -- Allowed customizing formatter class of argument parsers.
Backport of 2887b9f67c
from main
This commit is contained in:
parent
f741dd5fab
commit
99e5ce96c6
2 changed files with 9 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
from argparse import ArgumentDefaultsHelpFormatter
|
||||
from io import StringIO
|
||||
from unittest import mock
|
||||
|
||||
|
@ -408,8 +409,14 @@ class CommandTests(SimpleTestCase):
|
|||
def test_create_parser_kwargs(self):
|
||||
"""BaseCommand.create_parser() passes kwargs to CommandParser."""
|
||||
epilog = "some epilog text"
|
||||
parser = BaseCommand().create_parser("prog_name", "subcommand", epilog=epilog)
|
||||
parser = BaseCommand().create_parser(
|
||||
"prog_name",
|
||||
"subcommand",
|
||||
epilog=epilog,
|
||||
formatter_class=ArgumentDefaultsHelpFormatter,
|
||||
)
|
||||
self.assertEqual(parser.epilog, epilog)
|
||||
self.assertEqual(parser.formatter_class, ArgumentDefaultsHelpFormatter)
|
||||
|
||||
def test_outputwrapper_flush(self):
|
||||
out = StringIO()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue