#NEWLINE# def testable_memoized_property( func = None , key_factory = per_instance , **kwargs ) : #NEWLINE# #INDENT# 'A variant of `memoized_property` that allows for setting of properties (for tests, etc).' #NEWLINE# getter = memoized_method ( func = func , key_factory = setter , ** kwargs ) #NEWLINE# def setter( self , val ) : #NEWLINE# #INDENT# with getter . put ( self ) as putter : #NEWLINE# #INDENT# putter ( val ) #NEWLINE# #UNINDENT# #UNINDENT# return property ( fget = getter , fset = setter , fdel = ( lambda self : getter . forget ( self ) ) )