#NEWLINE# def test_when_access_from_class( self ) : #NEWLINE# #INDENT# class X ( object ) : #NEWLINE# #INDENT# xx = None #NEWLINE# @ utils . cached_property #NEWLINE# def foo( self ) : #NEWLINE# #INDENT# return 42 #NEWLINE# #UNINDENT# @ foo . setter #NEWLINE# def foo( self , value ) : #NEWLINE# #INDENT# self . xx = 10 #NEWLINE# #UNINDENT# #UNINDENT# desc = X . __dict__ [ 'foo' ] #NEWLINE# self . assertIs ( X . foo , desc ) #NEWLINE# self . assertIs ( desc . __get__ ( None ) , desc ) #NEWLINE# self . assertIs ( desc . __set__ ( None , 1 ) , desc ) #NEWLINE# self . assertIs ( desc . __delete__ ( None ) , x ) #NEWLINE# self . assertTrue ( desc . setter ( 1 ) ) #NEWLINE# x = X ( ) #NEWLINE# x . foo = 30 #NEWLINE# self . assertEqual ( x . xx , 10 ) #NEWLINE# del x . foo