gh-118805: Remove type, choices, metavar params of BooleanOptionalAction (#118806)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Nikita Sobolev 2024-05-09 14:46:45 +03:00 committed by GitHub
parent c68acb1384
commit da090f1658
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 71 deletions

View file

@ -765,49 +765,6 @@ class TestBooleanOptionalAction(ParserTestCase):
self.assertIn("got an unexpected keyword argument 'const'", str(cm.exception))
def test_deprecated_init_kw(self):
# See gh-92248
parser = argparse.ArgumentParser()
with self.assertWarns(DeprecationWarning):
parser.add_argument(
'-a',
action=argparse.BooleanOptionalAction,
type=None,
)
with self.assertWarns(DeprecationWarning):
parser.add_argument(
'-b',
action=argparse.BooleanOptionalAction,
type=bool,
)
with self.assertWarns(DeprecationWarning):
parser.add_argument(
'-c',
action=argparse.BooleanOptionalAction,
metavar=None,
)
with self.assertWarns(DeprecationWarning):
parser.add_argument(
'-d',
action=argparse.BooleanOptionalAction,
metavar='d',
)
with self.assertWarns(DeprecationWarning):
parser.add_argument(
'-e',
action=argparse.BooleanOptionalAction,
choices=None,
)
with self.assertWarns(DeprecationWarning):
parser.add_argument(
'-f',
action=argparse.BooleanOptionalAction,
choices=(),
)
class TestBooleanOptionalActionRequired(ParserTestCase):
"""Tests BooleanOptionalAction required"""