File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -857,7 +857,6 @@ class BooleanOptionalAction(Action):
857
857
def __init__ (self ,
858
858
option_strings ,
859
859
dest ,
860
- const = None ,
861
860
default = None ,
862
861
type = None ,
863
862
choices = None ,
Original file line number Diff line number Diff line change @@ -700,6 +700,14 @@ class TestBooleanOptionalAction(ParserTestCase):
700
700
('--no-foo --foo' , NS (foo = True )),
701
701
]
702
702
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
+
703
711
class TestBooleanOptionalActionRequired (ParserTestCase ):
704
712
"""Tests BooleanOptionalAction required"""
705
713
You can’t perform that action at this time.
0 commit comments