def test_one_of():
 assert (hug.types.one_of(('bacon', 'sausage', 'pancakes'))('bacon') == 'bacon')
 assert (hug.types.one_of(['bacon', 'sausage', 'pancakes'])('sausage') == 'sausage')
 assert (hug.types.one_of({'bacon', 'sausage', 'pancakes'})('pancakes') == 'pancakes')
 assert ('bacon' in hug.types.one_of({'bacon', 'sausage', 'pancakes'}).__doc__)
 with pytest.raises(KeyError):
  hug.types.one_of({'bacon', 'sausage', 'pancakes'})('syrup')

def test_one_of ( ) : assert ( hug . types . one_of ( ( 'bacon' , 'sausage' , 'pancakes' ) ) ( 'bacon' ) == 'bacon' ) assert ( hug . types . one_of ( [ 'bacon' , 'sausage' , 'pancakes' ] ) ( 'sausage' ) == 'sausage' ) assert ( hug . types . one_of ( { 'bacon' , 'sausage' , 'pancakes' } ) ( 'pancakes' ) == 'pancakes' ) assert ( 'bacon' in hug . types . one_of ( { 'bacon' , 'sausage' , 'pancakes' } ) . __doc__ ) with pytest . raises ( KeyError ) : hug . types . one_of ( { 'bacon' , 'sausage' , 'pancakes' } ) ( 'syrup' )
tests that hug allows limiting a value to one of a list of values .