@@ -67,17 +67,19 @@ def test_apcustom_completion_callable_count(kwargs, is_valid) -> None:
6767@pytest .mark .parametrize ('kwargs' , [({'choices_provider' : fake_func }), ({'completer' : fake_func })])
6868def test_apcustom_no_completion_callable_alongside_choices (kwargs ) -> None :
6969 parser = Cmd2ArgumentParser ()
70- with pytest .raises (ValueError ) as excinfo :
70+
71+ expected_err = "None of the following parameters can be used alongside a choices parameter"
72+ with pytest .raises (ValueError , match = expected_err ):
7173 parser .add_argument ('name' , choices = ['my' , 'choices' , 'list' ], ** kwargs )
72- assert 'None of the following parameters can be used alongside a choices parameter' in str (excinfo .value )
7374
7475
7576@pytest .mark .parametrize ('kwargs' , [({'choices_provider' : fake_func }), ({'completer' : fake_func })])
7677def test_apcustom_no_completion_callable_when_nargs_is_0 (kwargs ) -> None :
7778 parser = Cmd2ArgumentParser ()
78- with pytest .raises (ValueError ) as excinfo :
79+
80+ expected_err = "None of the following parameters can be used on an action that takes no arguments"
81+ with pytest .raises (ValueError , match = expected_err ):
7982 parser .add_argument ('--name' , action = 'store_true' , ** kwargs )
80- assert 'None of the following parameters can be used on an action that takes no arguments' in str (excinfo .value )
8183
8284
8385def test_apcustom_usage () -> None :
0 commit comments