File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -857,7 +857,6 @@ class BooleanOptionalAction(Action):
857857 def __init__ (self ,
858858 option_strings ,
859859 dest ,
860- const = None ,
861860 default = None ,
862861 type = None ,
863862 choices = None ,
Original file line number Diff line number Diff line change @@ -700,6 +700,14 @@ class TestBooleanOptionalAction(ParserTestCase):
700700 ('--no-foo --foo' , NS (foo = True )),
701701 ]
702702
703+ def test_const (self ):
704+ # See bpo-40862
705+ parser = argparse .ArgumentParser ()
706+ with self .assertRaises (TypeError ) as cm :
707+ parser .add_argument ('--foo' , const = True , action = argparse .BooleanOptionalAction )
708+
709+ self .assertIn ("got an unexpected keyword argument 'const'" , str (cm .exception ))
710+
703711class TestBooleanOptionalActionRequired (ParserTestCase ):
704712 """Tests BooleanOptionalAction required"""
705713
You can’t perform that action at this time.
0 commit comments