diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-12-15 04:20:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 12:20:04 +0000 |
commit | 8e4c96295bd78ae5f70b908e5dbac0da7c4c21bd (patch) | |
tree | ebbc320a1cfd9fad4c2c2a7fbdb3241d816216e0 /Lib/test/test_argparse.py | |
parent | 908fd691f96403a3c30d85c17dd74ed1f26a60fd (diff) | |
download | cpython-git-8e4c96295bd78ae5f70b908e5dbac0da7c4c21bd.tar.gz |
bpo-26952: [argparse] clearer error when formatting an empty mutually… (GH-30099) (GH-30114)
(cherry picked from commit 86de99588db3beff964137f4fe27dd1077a09b35)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_argparse.py')
-rw-r--r-- | Lib/test/test_argparse.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index ec49b2acbb..c96a540a8b 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -2582,6 +2582,13 @@ class TestMutuallyExclusiveGroupErrors(TestCase): ''' self.assertEqual(parser.format_help(), textwrap.dedent(expected)) + def test_empty_group(self): + # See issue 26952 + parser = argparse.ArgumentParser() + group = parser.add_mutually_exclusive_group() + with self.assertRaises(ValueError): + parser.parse_args(['-h']) + class MEMixin(object): def test_failures_when_not_required(self): |