#NEWLINE# def test_classgeneric_function_directive( ) : #NEWLINE# #INDENT# class app ( morepath . App ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# @ reg . dispatch ( reg . match_class ( 'o' , ( lambda o : o ) ) ) #NEWLINE# def mygeneric( o ) : #NEWLINE# #INDENT# return 'The object' #NEWLINE# #UNINDENT# class Foo ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# @ app . function ( mygeneric , o = Foo ) #NEWLINE# def mygeneric_for_foo( o ) : #NEWLINE# #INDENT# return 'The foo object' #NEWLINE# #UNINDENT# a = app ( ) #NEWLINE# assert ( mygeneric ( object , lookup = a . lookup ) == 'The object' ) #NEWLINE# assert ( mygeneric ( Foo , lookup = a . lookup ) == 'The foo object' )