#NEWLINE# def test_request_view_with_predicates( ) : #NEWLINE# #INDENT# class app ( morepath . App ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# dectate . commit ( app ) #NEWLINE# def view( self , request ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'hey' : 'hey' , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# app . config . view_registry . register_view ( dict ( model = Model , name = 'foo' ) , view , render = render_json ) #NEWLINE# request = app ( ) . request ( get_environ ( path = '' ) ) #NEWLINE# model = Model ( ) #NEWLINE# assert ( request . view ( model ) is None ) #NEWLINE# assert ( request . view ( model , name = 'foo' ) == { #NEWLINE# #INDENT# 'hey' : 'hey' , #NEWLINE# #UNINDENT# } ) #NEWLINE# request = app ( ) . request ( get_environ ( path = 'foo' ) ) #NEWLINE# assert ( request . view ( model ) is None )