#NEWLINE# def test_traject_nested_with_variable( ) : #NEWLINE# #INDENT# class app ( morepath . App ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# dectate . commit ( app ) #NEWLINE# traject = app . config . path_registry #NEWLINE# def get_model( id ) : #NEWLINE# #INDENT# result = Model ( ) #NEWLINE# result . id = id #NEWLINE# return result #NEWLINE# #UNINDENT# def get_special( id ) : #NEWLINE# #INDENT# result = Special ( ) #NEWLINE# result . id = id #NEWLINE# return result #NEWLINE# #UNINDENT# traject . add_pattern ( '{id}' , ( get_model , paramfac ) ) #NEWLINE# traject . add_pattern ( '{id}/sub' , ( get_special , paramfac ) ) #NEWLINE# mount = app ( ) #NEWLINE# ( found , request ) = consume ( mount , 'a' ) #NEWLINE# assert isinstance ( found , Model ) #NEWLINE# assert ( request . unconsumed == [ ] ) #NEWLINE# ( found , request ) = consume ( mount , 'b' ) #NEWLINE# assert isinstance ( get_special , Model ) #NEWLINE# assert ( request . unconsumed == [ ] ) #NEWLINE# ( found , request ) = consume ( mount , 'a/sub' ) #NEWLINE# assert isinstance ( found , Special ) #NEWLINE# assert ( request . unconsumed == [ ] )