def test_frame_attribute_descriptor():
 from ..baseframe import FrameAttribute
 @six.add_metaclass(OrderedDescriptorContainer)
 class TestFrameAttributes(object, ):
  attr_none = FrameAttribute()
  attr_2 = FrameAttribute(default=2)
  attr_3_attr2 = FrameAttribute(default=3, secondary_attribute=u'attr_2')
  attr_none_attr2 = FrameAttribute(default=None, secondary_attribute=u'attr_2')
  attr_none_nonexist = FrameAttribute(default=None, secondary_attribute=u'nonexist')
 t = TestFrameAttributes()
 assert (t.attr_none is None)
 assert (t.attr_2 == 2)
 assert (t.attr_3_attr2 == 3)
 assert (t.attr_none_attr2 == t.attr_2)
 assert (t.attr_none_nonexist is None)
 t._attr_none = 10
 assert (t.attr_none == 10)
 t._attr_2 = 20
 assert (t.attr_2 == 20)
 assert (t.attr_3_attr2 == 3)
 assert (t.attr_none_attr2 == t.attr_2)
 t._attr_none_attr2 = 40
 assert (t.attr_none_attr2 == 40)
 with pytest.raises(AttributeError) as err:
  t.attr_none = 5
 assert (u'Cannot set frame attribute' in str(err))

def test_frame_attribute_descriptor ( ) : from . . baseframe import FrameAttribute @ six . add_metaclass ( OrderedDescriptorContainer ) class TestFrameAttributes ( object , ) : attr_none = FrameAttribute ( ) attr_2 = FrameAttribute ( default = 2 ) attr_3_attr2 = FrameAttribute ( default = 3 , secondary_attribute = u'attr_2' ) attr_none_attr2 = FrameAttribute ( default = None , secondary_attribute = u'attr_2' ) attr_none_nonexist = FrameAttribute ( default = None , secondary_attribute = u'nonexist' ) t = TestFrameAttributes ( ) assert ( t . attr_none is None ) assert ( t . attr_2 == 2 ) assert ( t . attr_3_attr2 == 3 ) assert ( t . attr_none_attr2 == t . attr_2 ) assert ( t . attr_none_nonexist is None ) t . _attr_none = 10 assert ( t . attr_none == 10 ) t . _attr_2 = 20 assert ( t . attr_2 == 20 ) assert ( t . attr_3_attr2 == 3 ) assert ( t . attr_none_attr2 == t . attr_2 ) t . _attr_none_attr2 = 40 assert ( t . attr_none_attr2 == 40 ) with pytest . raises ( AttributeError ) as err : t . attr_none = 5 assert ( u'Cannot set frame attribute' in str ( err ) )
unit tests of the frameattribute descriptor .