def test_property_always_set_descriptor():
 class C(object, ):
  x = property((lambda self: self._x))
  def __init__(self):
   self._x = 42
 c = C()
 c.__dict__['x'] = 43
 AreEqual(c.x, 42)
 class MyDescriptor(object, ):
  def __get__(self, *args):
   return 42
 class C(object, ):
  x = MyDescriptor()
 c = C()
 c.__dict__['x'] = 43
 AreEqual(c.x, 43)
 class MyDescriptor(object, ):
  def __get__(self, *args):
   return 42
  def __set__(self, *args):
   pass
 class C(object, ):
  x = MyDescriptor()
 c = C()
 c.__dict__['x'] = 43
 AreEqual(c.x, 42)

def test_property_always_set_descriptor ( ) : class C ( object , ) : x = property ( ( lambda self : self . _x ) ) def __init__ ( self ) : self . _x = 42 c = C ( ) c . __dict__ [ 'x' ] = 43 AreEqual ( c . x , 42 ) class MyDescriptor ( object , ) : def __get__ ( self , * args ) : return 42 class C ( object , ) : x = MyDescriptor ( ) c = C ( ) c . __dict__ [ 'x' ] = 43 AreEqual ( c . x , 43 ) class MyDescriptor ( object , ) : def __get__ ( self , * args ) : return 42 def __set__ ( self , * args ) : pass class C ( object , ) : x = MyDescriptor ( ) c = C ( ) c . __dict__ [ 'x' ] = 43 AreEqual ( c . x , 42 )
verifies that set descriptors take precedence over dictionary entries and properties are always treated as set descriptors .