def test_prefix():
 transformer = hug.transform.prefix({'js/': int, 'txt/': str})
 class FakeRequest(object, ):
  path = 'js/hey'
 request = FakeRequest()
 assert (transformer('1', request) == 1)
 request.path = 'txt/hey'
 assert (transformer(2, request) == '2')
 request.path = 'hey.undefined'
 (transformer({'data': 'value'}, request) == {'data': 'value'})

def test_prefix ( ) : transformer = hug . transform . prefix ( { 'js/' : int , 'txt/' : str } ) class FakeRequest ( object , ) : path = 'js/hey' request = FakeRequest ( ) assert ( transformer ( '1' , request ) == 1 ) request . path = 'txt/hey' assert ( transformer ( 2 , request ) == '2' ) request . path = 'hey.undefined' ( transformer ( { 'data' : 'value' } , request ) == { 'data' : 'value' } )
test that table prefixes affect the names of querystring parameters .