#NEWLINE# def test_custom_validaters( ) : #NEWLINE# #INDENT# api = Api ( ) #NEWLINE# def foo_validater( v ) : #NEWLINE# #INDENT# return ( True , v ) #NEWLINE# #UNINDENT# api . validater . add_validater ( 'foo' , foo_validater ) #NEWLINE# assert ( 'foo' in api . validater . validaters ) #NEWLINE# assert ( 'foo' not in validater . default_validaters ) #NEWLINE# sche = api . validater . parse ( 'foo&required' ) #NEWLINE# ( err , val ) = validater . validate ( 'haha' , sche ) #NEWLINE# assert ( not err ) #NEWLINE# assert ( val == 'haha' ) #NEWLINE# ( err , val ) = api . validater . validate ( 'haha' , sche ) #NEWLINE# assert ( not err ) #NEWLINE# assert ( val == 'haha' ) #NEWLINE# api . validater . remove_validater ( 'foo' ) #NEWLINE# assert ( 'foo' not in api . validater . validaters )