@pytest.mark.parametrize('value, typ', [(None, None), (42, int)])
def test_conv_default_param(value, typ):
 def func(foo=value):
  pass
 param = inspect.signature(func).parameters['foo']
 assert (argparser.type_conv(param, typ, value, str_choices=['val']) == value)

@ pytest . mark . parametrize ( 'value, typ' , [ ( None , None ) , ( 42 , int ) ] ) def test_conv_default_param ( value , typ ) : def func ( foo = value ) : pass param = inspect . signature ( func ) . parameters [ 'foo' ] assert ( argparser . type_conv ( param , typ , value , str_choices = [ 'val' ] ) == value )
the default value should always be a valid choice .