#NEWLINE# def test_required_validator( self ) : #NEWLINE# #INDENT# validator = { #NEWLINE# #INDENT# 'truthiness' : [ Required ] , #NEWLINE# 'falsiness' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# str_value = { #NEWLINE# #INDENT# 'truthiness' : 'test' , #NEWLINE# #UNINDENT# } #NEWLINE# int_value = { #NEWLINE# #INDENT# 'truthiness' : 1 , #NEWLINE# #UNINDENT# } #NEWLINE# bool_value = { #NEWLINE# #INDENT# 'truthiness' : True , #NEWLINE# #UNINDENT# } #NEWLINE# missing_value = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# assert validate ( validator , str_value ) [ 0 ] #NEWLINE# assert validate ( validator , int_value ) [ 0 ] #NEWLINE# assert validate ( validator , bool_value ) [ 0 ] #NEWLINE# ( validity , errors ) = validate ( validator , missing_value ) #NEWLINE# assert ( errors [ 'truthiness' ] == 'must be present' )