#NEWLINE# def test_validators_inheritance( self ) : #NEWLINE# #INDENT# class A ( SchemaDocument ) : #NEWLINE# #INDENT# structure = { #NEWLINE# #INDENT# 'a' : { #NEWLINE# #INDENT# 'foo' : int , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# validators = { #NEWLINE# #INDENT# 'a.foo' : ( lambda x : ( x > 1 ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# class B ( A ) : #NEWLINE# #INDENT# structure = { #NEWLINE# #INDENT# 'b' : { #NEWLINE# #INDENT# 'bar' : unicode , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# b = B ( ) #NEWLINE# b [ 'a' ] [ 'foo' ] = 0 #NEWLINE# self . assertRaises ( ValidationError , b . validate ) #NEWLINE# b [ 'a' ] [ 'foo' ] = 3 #NEWLINE# b . validate ( ) #NEWLINE# class C ( A ) : #NEWLINE# #INDENT# validators = { #NEWLINE# #INDENT# 'a.foo' : ( lambda x : ( x < 1 ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# class D ( C ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# d = D ( ) #NEWLINE# d [ 'a' ] [ 'foo' ] = 4 #NEWLINE# self . assertRaises ( ValidationError , self . validate ) #NEWLINE# d [ 'a' ] [ 'foo' ] = ( - 3 ) #NEWLINE# d . validate ( )