@@ -6730,9 +6730,19 @@ def test_conflicting_mutually_exclusive_args_zero_or_more_with_metavar2(self):
6730
6730
def test_ambiguous_option (self ):
6731
6731
self .parser .add_argument ('--foobaz' )
6732
6732
self .parser .add_argument ('--fooble' , action = 'store_true' )
6733
+ self .parser .add_argument ('--foogle' )
6733
6734
self .assertRaisesRegex (argparse .ArgumentError ,
6734
- "ambiguous option: --foob could match --foobaz, --fooble" ,
6735
- self .parser .parse_args , ['--foob' ])
6735
+ "ambiguous option: --foob could match --foobaz, --fooble" ,
6736
+ self .parser .parse_args , ['--foob' ])
6737
+ self .assertRaisesRegex (argparse .ArgumentError ,
6738
+ "ambiguous option: --foob=1 could match --foobaz, --fooble$" ,
6739
+ self .parser .parse_args , ['--foob=1' ])
6740
+ self .assertRaisesRegex (argparse .ArgumentError ,
6741
+ "ambiguous option: --foob could match --foobaz, --fooble$" ,
6742
+ self .parser .parse_args , ['--foob' , '1' , '--foogle' , '2' ])
6743
+ self .assertRaisesRegex (argparse .ArgumentError ,
6744
+ "ambiguous option: --foob=1 could match --foobaz, --fooble$" ,
6745
+ self .parser .parse_args , ['--foob=1' , '--foogle' , '2' ])
6736
6746
6737
6747
def test_os_error (self ):
6738
6748
self .parser .add_argument ('file' )
0 commit comments