#NEWLINE# def test_link_to_none( ) : #NEWLINE# #INDENT# class app ( morepath . App ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# @ app . path ( path = '' ) #NEWLINE# class Root ( object ) : #NEWLINE# #INDENT# def __init__( self ) : #NEWLINE# #INDENT# self . value = 'ROOT' #NEWLINE# #UNINDENT# #UNINDENT# class Model ( object ) : #NEWLINE# #INDENT# def __init__( self , id ) : #NEWLINE# #INDENT# self . id = id #NEWLINE# #UNINDENT# #UNINDENT# @ app . view ( model = Root ) #NEWLINE# def root_link( self , request ) : #NEWLINE# #INDENT# return str ( ( request . link ( None ) is None ) ) #NEWLINE# #UNINDENT# @ app . view ( model = Root , name = 'default' ) #NEWLINE# def root_link_with_default( self , request ) : #NEWLINE# #INDENT# return request . link ( None , default = 'unknown' ) #NEWLINE# #UNINDENT# c = Client ( app ( ) ) #NEWLINE# response = c . get ( '/' ) #NEWLINE# assert ( response . body == b'True' ) #NEWLINE# response = c . get ( '/default' ) #NEWLINE# assert ( response . body == b'unknown' )