diff options
author | Ned Deily <nad@python.org> | 2018-05-23 21:55:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-23 21:55:15 -0400 |
commit | 8ebf5ceb0f5408d1ebc26c19702ac0762ef5ea04 (patch) | |
tree | eca9d86e7742c3ed4996506cfc7958b3582e07e6 /Lib/test/test_argparse.py | |
parent | 453bd0bc65b7ea6a18c43da69143ab10d54c0a35 (diff) | |
download | cpython-git-8ebf5ceb0f5408d1ebc26c19702ac0762ef5ea04.tar.gz |
bpo-33109: argparse subparsers are once again not required by default (GH-6919)
bpo-26510 in 3.7.0a2 changed the behavior of argparse to make
subparsers required by default, returning to the behavior of 2.7
and 3.2. The behavior was changed in 3.3 to be no longer required.
While it might make more sense to have the default to required,
compatibility with 3.3 through 3.6 is probably less disruptive
than trying to reintroduce compatibility with 2.7 at this point.
This change restores the 3.6 behavior.
Diffstat (limited to 'Lib/test/test_argparse.py')
-rw-r--r-- | Lib/test/test_argparse.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index c4440e4df7..bcf15ce123 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -1932,7 +1932,9 @@ class TestAddSubparsers(TestCase): parser = ErrorRaisingArgumentParser() subparsers = parser.add_subparsers(dest='command') subparsers.add_parser('run') - self._test_required_subparsers(parser) + # No error here + ret = parser.parse_args(()) + self.assertIsNone(ret.command) def test_optional_subparsers(self): parser = ErrorRaisingArgumentParser() |