bpo-26952: [argparse] clearer error when formatting an empty mutually… (GH-30099)

This commit is contained in:
Irit Katriel 2021-12-15 10:08:26 +00:00 committed by GitHub
parent f54fee7f37
commit 86de99588d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -2601,6 +2601,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):