#NEWLINE# def _test_object( self , typecallable , creator = None ) : #NEWLINE# #INDENT# if ( creator is None ) : #NEWLINE# #INDENT# creator = self . entity_maker #NEWLINE# #UNINDENT# class Foo ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# canary = Canary ( ) #NEWLINE# instrumentation . register_class ( Foo ) #NEWLINE# attributes . register_attribute ( Foo , 'attr' , uselist = True , extension = canary , typecallable = typecallable , useobject = True ) #NEWLINE# obj = Foo ( ) #NEWLINE# adapter = collections . collection_adapter ( obj . attr ) #NEWLINE# direct = obj . attr #NEWLINE# control = set ( ) #NEWLINE# def assert_eq( ) : #NEWLINE# #INDENT# self . assert_ ( ( set ( direct ) == canary . data ) ) #NEWLINE# self . assert_ ( ( set ( adapter ) == canary . data ) ) #NEWLINE# self . assert_ ( ( direct == control ) ) #NEWLINE# #UNINDENT# e = creator ( ) #NEWLINE# direct . push ( e ) #NEWLINE# control . add ( e ) #NEWLINE# assert_eq ( ) #NEWLINE# direct . zark ( e ) #NEWLINE# control . remove ( e ) #NEWLINE# assert_eq ( ) #NEWLINE# e = creator ( ) #NEWLINE# direct . maybe_zark ( e ) #NEWLINE# control . discard ( e ) #NEWLINE# assert_eq ( ) #NEWLINE# e = creator ( ) #NEWLINE# direct . push ( e ) #NEWLINE# control . add ( e ) #NEWLINE# assert_eq ( ) #NEWLINE# e = creator ( ) #NEWLINE# direct . maybe_zark ( e ) #NEWLINE# control . discard ( e ) #NEWLINE# assert_eq ( )