#NEWLINE# def test_class_load_hooks( self ) : #NEWLINE# #INDENT# ' class load hooks ' #NEWLINE# from envisage.core_plugin import CorePlugin #NEWLINE# def on_class_loaded( cls ) : #NEWLINE# #INDENT# ' Called when a class has been loaded. ' #NEWLINE# on_class_loaded . cls = cls #NEWLINE# return #NEWLINE# #UNINDENT# class PluginA ( Plugin ) : #NEWLINE# #INDENT# id = 'A' #NEWLINE# class_load_hooks = List ( [ ClassLoadHook ( class_name = ( CorePluginTestCase . __module__ + '.Baz' ) , on_load = on_class_loaded ) ] , contributes_to = 'envisage.class_load_hooks' ) #NEWLINE# #UNINDENT# core = CorePlugin ( ) #NEWLINE# a = PluginA ( ) #NEWLINE# application = TestApplication ( plugins = [ core , a ] ) #NEWLINE# application . start ( ) #NEWLINE# class Bif ( HasTraits ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . assert_ ( ( not hasattr ( on_class_loaded , 'cls' ) ) ) #NEWLINE# class Baz ( HasTraits ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . assertEqual ( Baz , self . cls ) #NEWLINE# return