def test_conv_str_choices_invalid():
 param = inspect.Parameter('foo', inspect.Parameter.POSITIONAL_ONLY)
 with pytest.raises(cmdexc.ArgumentTypeError) as excinfo:
  argparser.type_conv(param, str, 'val3', str_choices=['val1', 'val2'])
 msg = 'foo: Invalid value val3 - expected one of: val1, val2'
 assert (str(excinfo.value) == msg)

def test_conv_str_choices_invalid ( ) : param = inspect . Parameter ( 'foo' , inspect . Parameter . POSITIONAL_ONLY ) with pytest . raises ( cmdexc . ArgumentTypeError ) as excinfo : argparser . type_conv ( param , str , 'val3' , str_choices = [ 'val1' , 'val2' ] ) msg = 'foo: Invalid value val3 - expected one of: val1, val2' assert ( str ( excinfo . value ) == msg )
calling str type with str_choices and invalid value .